osusec / beavercds-ng

new implementation of beavercds/rcds
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Implement environment variable overrides for config options #15

Open detjensrobert opened 5 days ago

detjensrobert commented 5 days ago

Currently all settings are read from config.yaml as is. As documented in the config file design, we want to allow sensitive values to be read from environment variables, instead of needing to be written down and commited in config.yaml.

Unsure if we want this to only be for credential settings, or allow overrides for any setting from an envvar (this might be impossible without restructuring how we parse stuff to allow defaults for all values).

I see two ways to do this:

registry:
  build: 
    user:  # --> REGISTRY_BUILD_USER
    pass:  # --> REGISTRY_BUILD_PASS
  cluster:
    user:  # --> REGISTRY_CLUSTER_USER
    pass:  # --> REGISTRY_CLUSTER_USER
registry:
  build: 
    user:  
      from_env: REGISTRY_BUILD_USER
    pass: 
      from_env: REGISTRY_BUILD_PASS

The latter might be easier to do with the way Serde wants to parse stuff.

KekoaM commented 3 days ago

I support explicit envvar setting It makes it clearer what is happening without having to reference the docs for what the silent overrides are. And making Serde happier is a bonus