-
Notifications
You must be signed in to change notification settings - Fork 52
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
override configuration keys with environment variables #663
Conversation
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.
LGTM, Arne could you document the variables that can be set from the environment?
86d004b
to
1e42187
Compare
} | ||
|
||
root := p.v.GetStringMap(keys[0]) | ||
setDeepValue(root, keys, val) |
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.
Maybe it makes more sense to pass keys[1:]
, because keys[0]
is not in the map. Just for consistency in your method inputs.
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.
agree that it would be more logical in some sense, but somehow it wasn't easy to change so I left it.
Signed-off-by: Arne Rutjes <[email protected]>
Signed-off-by: Arne Rutjes <[email protected]>
Signed-off-by: Arne Rutjes <[email protected]>
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.
LGTM
This PR enables the user to override any configuration key with an environment variable. Technically we were supposed to already have this feature (via viper's AutomaticEnv), but it was flaky and unpredictable:
With this change you can for instance share a 'default' core.yaml, but override node specific data like the database connectionString or the node id. To prevent confusion the environment variables for logging and the vault config have been removed so that they can only be accessed via the same path as other configurations.
The commit also upgrades viper to the latest stable version. That means that if we merge this and upgrade Token SDK, we have to make sure it deals with lowercase map keys properly (like we already do with for instance the P2P field in FSC).