-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add method GetStringEnv
which will interpolate environmental variables
#581
base: master
Are you sure you want to change the base?
Conversation
…ke environmental variables and return them;
Nathan Trujillo seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Add method `GetStringEnv` which will interpolate values which look li…
Hey, thanks for the contribution! I'm hesitant to bring in a feature like this, for a couple reasons.
|
The README.md states that Viper supports: Maybe that can read: Since,
will never work for just If I use environment variables in several places in a file, I don't want to make new ones as Why would that change if I use Viper? |
How about some configuration that optionally turns on variable expansion (eg. calls `os.ExpandEnv) for environment variables? Alternatively variable expansion could be an option for not just env vars, but all configurations. |
I would like to second the request and add my usecase: configuring multiple environments with the same yaml/toml field structure, but needing different values: [qa]
host = '${HOSTQA}'
[prod]
host = '${MAINLB}' |
# Conflicts: # go.mod # go.sum # viper_test.go
This will interpolate values that look like
${HOME}
and assign with $HOME from environment.