mirror of
https://github.com/spf13/viper
synced 2024-12-23 03:57:01 +00:00
Improve BindEnv details
This commit is contained in:
parent
96441b4b74
commit
d34be8d9ee
1 changed files with 3 additions and 2 deletions
|
@ -225,8 +225,9 @@ prefix.
|
||||||
`BindEnv` takes one or two parameters. The first parameter is the key name, the
|
`BindEnv` takes one or two parameters. The first parameter is the key name, the
|
||||||
second is the name of the environment variable. The name of the environment
|
second is the name of the environment variable. The name of the environment
|
||||||
variable is case sensitive. If the ENV variable name is not provided, then
|
variable is case sensitive. If the ENV variable name is not provided, then
|
||||||
Viper will automatically assume that the ENV variable is the prefix + "_" + the key name in ALL CAPS. When you explicitly provide the ENV
|
Viper will automatically assume that the ENV variable matches the following format: prefix + "_" + the key name in ALL CAPS. When you explicitly provide the ENV variable name (the second parameter),
|
||||||
variable name which is the second parameter, it **does not** automatically add the prefix, which means if the second parameter is "id", the environment variable is just plain "ID".
|
it **does not** automatically add the prefix. For example if the second parameter is "id",
|
||||||
|
Viper will look for the ENV variable "ID".
|
||||||
|
|
||||||
One important thing to recognize when working with ENV variables is that the
|
One important thing to recognize when working with ENV variables is that the
|
||||||
value will be read each time it is accessed. Viper does not fix the value when
|
value will be read each time it is accessed. Viper does not fix the value when
|
||||||
|
|
Loading…
Reference in a new issue