-
Notifications
You must be signed in to change notification settings - Fork 1
Config file envvar overrides #20
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
Conversation
| where | ||
| E: de::Error, | ||
| { | ||
| Ok(FromStr::from_str(value).unwrap()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unwrap here probably isn't ideal, I'd prefer returning a de::Error variant (maybe with de::Error::invalid_value?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value here is always going to be a &str, so AFAICT there's no chance it will ever fail here. I stole this code from Serde's documentation examples so I'm also not really sure why this is doing the from_str dance on an existing &str to begin with.
cacama-valvata
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed synchronously 11/05/24 -- approved
serde-yaml is deprecated and not maintained, serde-yml is the new fork Signed-off-by: Robert Detjens <github@detjens.dev>
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 <github@detjens.dev>
Signed-off-by: Robert Detjens <github@detjens.dev>
Signed-off-by: Robert Detjens <github@detjens.dev>
2945c1d to
ab6d6b8
Compare
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.yamlcan 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:
Fixes #15.
Supersedes #18.