question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make it easier to merge configuration into config at runtime

See original GitHub issue

Context

Related #13952

We’re experimenting with different ways to satisfy security requirements for one of our clients, where they’re not allowed to use environment variables to store secrets. We tried a bunch of different approaches; one of them is to load secrets before reading configs and merging them into configuration. This proved surprisingly difficult. We tried to modify main() in packages/backend/src/index.ts to read secrets before calling loadBackendConfig, but we couldn’t figure out the right way to load those values into the config object.

Feature Suggestion

Provide an API to merge or derive a config object by merging a POJO into a config.

Possible Implementation

Something like this would be great,

const static = await loadBackendConfig({
  argv: process.argv,
  logger,
});
  
const config = static.merge({
  backend: {
     database: {
        password: await readFromSecretStore('db_password')
     }
  }
})

Is this possible?

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
OrkoHuntercommented, Oct 17, 2022

I have recently also seen companies frown upon secrets in configs via environment variables - they are so peculiar about their own secret managers, and want to use that only. So +1 to updating configs during runtime or #13952. 😃

1reaction
frebencommented, Oct 17, 2022

@shailendra-ahir-cbre There’s a “Subscribe” button in the right sidebar for that purpose.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Merging runtime-created section config with system config
The sample code goes on to merge the created configuration info with an empty DictionaryConfigurationSource. I, however, need to merge it with the...
Read more >
[RFC] Better way to override Backstage's configuration from a ...
Need A way to dynamically override the configuration of Backstage ... config would be merged into a singe config if it was simple...
Read more >
Configuring Services Using Configuration Files - WCF
Behavior merge works in the IIS hosting environment, in which Web.config files merge hierarchically with the root Web.config file and machine.
Read more >
Elixir 1.9 Configuration Merging - Stratus3D
Config.Reader recursively merges the configurations in order until they are all combined. The first config call defines the base configuration.
Read more >
Providing environment specific configuration for JavaScript ...
Using React, we want to minify and combine all of our application files into a single JavaScript file to optimize the run-time experience....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found