fix: allow env vars to override setup defaults (#3800)

This commit is contained in:
Livio Spring 2022-06-10 15:34:52 +02:00 committed by GitHub
parent 6bd5799770
commit 504d91d424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ package setup
import (
"bytes"
"strings"
"github.com/mitchellh/mapstructure"
"github.com/spf13/viper"
@ -57,6 +58,9 @@ type encryptionKeyConfig struct {
}
func MustNewSteps(v *viper.Viper) *Steps {
viper.AutomaticEnv()
viper.SetEnvPrefix("ZITADEL")
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
v.SetConfigType("yaml")
err := v.ReadConfig(bytes.NewBuffer(defaultSteps))
logging.OnError(err).Fatal("unable to read setup steps")