Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config file envvar overrides #20

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

detjensrobert
Copy link
Contributor

@detjensrobert detjensrobert commented Oct 28, 2024

Switch to building global and challenge configs with Figment instead of directly with Serde. Figment can merge multiple sources together before deserializing, including from environment variables.

This gets us envvar overrides for basically free. Any config in rcds.yaml can be set from envvars -- BEAVERCDS_<path>. Fields that are overridden from envvars can be omitted from the config file, since parsing happens after the merge. This allows users to not need to specify a placeholder value that's immediately replaced.

Previously in #15 we agreed on from_env: subkeys, but that would need us to do all the parsing and substitution ourselves. With this approach this library does these overrides for free, and also gets us very good test capabilities for overrides and parsing and so on.

examples:

registry:
  cluster:
    user:  # ==> BEAVERCDS_REGISTRY_CLUSTER_USER
    pass:  # ==> BEAVERCDS_REGISTRY_CLUSTER_PASS
  # the whole cluster: section can be omitted if both these are set

profiles:
  foo:
    frontend_token:  # ==> BEAVERCDS_PROFILES_FOO_FRONTEND_TOKEN

Fixes #15.

Supersedes #18.

- coerce string `build:` directory into full build context object
- allow only one of either `build:` or `image:` fields

Signed-off-by: Robert Detjens <[email protected]>
serde-yaml is deprecated and not maintained, serde-yml is the new fork

Signed-off-by: Robert Detjens <[email protected]>
This file is autogenerated and we (users) don't care about the specifics of
what has changed in it, only that it has.

Signed-off-by: Robert Detjens <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement environment variable overrides for config options
1 participant