add ENV config support

This commit is contained in:
Paolo Asperti 2022-06-03 16:35:04 +02:00
parent 0f51dc8115
commit e20f6a4597
Signed by: paspo
GPG Key ID: 06D46905D19D5182

View File

@ -7,6 +7,9 @@ import (
) )
func init() { func init() {
viper.SetEnvPrefix("OPENPDU_")
viper.AllowEmptyEnv(true)
viper.AutomaticEnv()
viper.SetConfigName("openpdu") // name of config file (without extension) viper.SetConfigName("openpdu") // name of config file (without extension)
viper.SetConfigType("yaml") viper.SetConfigType("yaml")
viper.AddConfigPath(".") // optionally look for config in the working directory viper.AddConfigPath(".") // optionally look for config in the working directory