TODO: should getEnv logic be moved into find(). Can generalize the use of rewriting keys many things, Ex: Get('someKey') -> some_key (camel case to snake case for JSON keys perhaps) getEnv is a wrapper around os.Getenv which replaces characters in the original key. This allows env vars which have di
(key string)
| 440 | // key. This allows env vars which have different keys than the config object |
| 441 | // keys. |
| 442 | func (v *Viper) getEnv(key string) (string, bool) { |
| 443 | if v.envKeyReplacer != nil { |
| 444 | key = v.envKeyReplacer.Replace(key) |
| 445 | } |
| 446 | |
| 447 | val, ok := os.LookupEnv(key) |
| 448 | |
| 449 | return val, ok && (v.allowEmptyEnv || val != "") |
| 450 | } |
| 451 | |
| 452 | // ConfigFileUsed returns the file used to populate the config registry. |
| 453 | func ConfigFileUsed() string { return v.ConfigFileUsed() } |
no test coverage detected