diff --git a/cmd/root.go b/cmd/root.go index cb1cafeff0..f43271f4d8 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -22,13 +22,10 @@ import ( "github.com/evcc-io/evcc/util/pipe" "github.com/evcc-io/evcc/util/sponsor" "github.com/evcc-io/evcc/util/telemetry" - "github.com/fatih/structs" - "github.com/jeremywohl/flatten" _ "github.com/joho/godotenv/autoload" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/spf13/cobra" "github.com/spf13/viper" - "golang.org/x/exp/maps" ) const rebootDelay = 5 * time.Minute // delayed reboot on error @@ -93,12 +90,6 @@ func initConfig() { viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) viper.AutomaticEnv() // read in environment variables that match - // register all known config keys - flat, _ := flatten.Flatten(structs.Map(conf), "", flatten.DotStyle) - for _, v := range maps.Keys(flat) { - _ = viper.BindEnv(v) - } - // print version util.LogLevel("info", nil) log.INFO.Printf("evcc %s", server.FormattedVersion()) diff --git a/go.mod b/go.mod index b6d0904222..7887f3d3ad 100644 --- a/go.mod +++ b/go.mod @@ -84,7 +84,7 @@ require ( github.com/spf13/cobra v1.8.0 github.com/spf13/jwalterweatherman v1.1.0 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.17.0 + github.com/spf13/viper v1.18.1 github.com/stretchr/testify v1.8.4 github.com/traefik/yaegi v0.15.1 github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c diff --git a/go.sum b/go.sum index 3c5cf948f0..b5f4941194 100644 --- a/go.sum +++ b/go.sum @@ -646,8 +646,8 @@ github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0 github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= -github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= +github.com/spf13/viper v1.18.1 h1:rmuU42rScKWlhhJDyXZRKJQHXFX02chSVW1IvkPGiVM= +github.com/spf13/viper v1.18.1/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=