Update docs - viper - [fork] go viper port for 9front
(HTM) git clone git@git.drkhsh.at/viper.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit ea890285a5a7cfe1c55ac80d11f20c78d94259f9
(DIR) parent b655224c01bdc85dd8d755f21dbe32699258a626
(HTM) Author: Gabriel Aszalos <gabriel.aszalos@gmail.com>
Date: Wed, 30 Sep 2020 13:24:59 +0300
Update docs
Diffstat:
M README.md | 7 ++++---
M viper.go | 2 ++
2 files changed, 6 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/README.md b/README.md
@@ -250,9 +250,10 @@ using `SetEnvPrefix`, you can tell Viper to use a prefix while reading from
the environment variables. Both `BindEnv` and `AutomaticEnv` will use this
prefix.
-`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
-variable is case sensitive. If the ENV variable name is not provided, then
+`BindEnv` takes one or more parameters. The first parameter is the key name, the
+rest are the name of the environment variables to bind to this key. If more than
+one are provided, they will take precedence in the specified order. The name of
+the environment variable is case sensitive. If the ENV variable name is not provided, then
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),
it **does not** automatically add the prefix. For example if the second parameter is "id",
Viper will look for the ENV variable "ID".
(DIR) diff --git a/viper.go b/viper.go
@@ -1025,6 +1025,8 @@ func (v *Viper) BindFlagValue(key string, flag FlagValue) error {
// BindEnv binds a Viper key to a ENV variable.
// ENV variables are case sensitive.
// If only a key is provided, it will use the env key matching the key, uppercased.
+// If more arguments are provided, they will represent the env variable names that
+// should bind to this key and will be taken in the specified order.
// EnvPrefix will be used when set when env name is not provided.
func BindEnv(input ...string) error { return v.BindEnv(input...) }