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
[FLI-907] config: add ability to specify env vars #2844
Labels
enhancement
Created by Linear-GitHub Sync
go
good first issue
help wanted
Halp
md
Not too big, not too small
Comments
markphelps
changed the title
config: add ability to specify env vars
[FLI-907] config: add ability to specify env vars
Mar 12, 2024
💯 we already extensively used custom decoder hooks. So it could be added here: flipt/internal/config/config.go Lines 21 to 30 in 19a5acc
It could likely be implemented as one that maps from string to string. |
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
Created by Linear-GitHub Sync
go
good first issue
help wanted
Halp
md
Not too big, not too small
Problem
Currently, Flipt supports configuration via YAML or ENV vars (https://www.flipt.io/docs/configuration/overview). Environment variables override config files. Env var keys that Flipt supports comes directly from the keys of the YAML config.
What we don't currently allow is specifying env vars in the conf file format.
Why this could be a problem is the env var keys become exceptionally long depending on how deeply nested the corresponding YAML config is. Example:
authentication.methods.oidc.providers.github.client_id
in YAML becomesFLIPT_AUTHENTICATION_METHODS_OIDC_PROVIDERS_GITHUB_CLIENT_ID
as an env var.Ideal Solution
It would be nice if we could provide a 'shortcut' for specifying configuration in YAML that would allow users to specify env var keys that we should look in for the correct value.
Ie:
"${env:FLIPT_GITHUB_CLIENT_ID}"
This would allow users to swap in whatever env var keys they want and we could look for those values at startup, failing fast if we cant find the env var value.
Search
Additional Context
Since we use Viper for config parsing, I think we could use some of the tactics described in this blog post: https://sagikazarmark.hu/blog/decoding-custom-formats-with-viper/ to decode a value that follows with the above format
${env:value}
FLI-907
The text was updated successfully, but these errors were encountered: