Currently all config values are defined in yaml config files. Therefore, all these values are in plaintext in version control. This would be inappropriate for sensitive values such as api secret keys which need to remain hidden.
Requirements
Add the ability to fill config values from specified environment variables.
TBD
[x] What about fields that we only want to fill with environment vars some of the time?
possible solution: try to parse into EnvironmentReadValue, if fails then try to parse directly into T, if fails then bubble up failure
Describe the solution you'd like
yaml configs should dictate the name of the environment variable to read from in the format:
EnvironmentReadValue should be able to deserialize from a string such as "${SECRET_ENV_VAR}" and then return it's value of type T.
ToDos
[x] resolve bubbling up errors reading values from environment when config values are accessed
could move to model where EnvironmentReadValue properties are used on a builder type. Then this builder type is converted into the target config type. The build process could be fallible but each access of the built type would be simple.
[x] unit test env reading of web config port
[x] remove derived serde traits from Config structs that don't need them
Background
Currently all config values are defined in yaml config files. Therefore, all these values are in plaintext in version control. This would be inappropriate for sensitive values such as api secret keys which need to remain hidden.
Requirements
Add the ability to fill config values from specified environment variables.
TBD
EnvironmentReadValue
, if fails then try to parse directly intoT
, if fails then bubble up failureDescribe the solution you'd like
yaml configs should dictate the name of the environment variable to read from in the format:
Then, in code we could have a type:
EnvironmentReadValue
should be able to deserialize from a string such as"${SECRET_ENV_VAR}"
and then return it's value of typeT
.ToDos
EnvironmentReadValue
properties are used on a builder type. Then this builder type is converted into the target config type. The build process could be fallible but each access of the built type would be simple.