initEnv sets to use ENV variables if set.
(prefix string)
| 46 | |
| 47 | // initEnv sets to use ENV variables if set. |
| 48 | func initEnv(prefix string) { |
| 49 | copyEnvVars(prefix) |
| 50 | |
| 51 | // env variables with TM prefix (eg. TM_ROOT) |
| 52 | viper.SetEnvPrefix(prefix) |
| 53 | viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_", "-", "_")) |
| 54 | viper.AutomaticEnv() |
| 55 | } |
| 56 | |
| 57 | // This copies all variables like TMROOT to TM_ROOT, |
| 58 | // so we can support both formats for the user |
no test coverage detected