Set AutomaticEnv for viper (#131)

This allows viper configuration to be set using environment variables
instead of just with a config file.
This commit is contained in:
jonjohnsonjr
2020-02-06 13:51:22 -08:00
committed by GitHub
parent ca1b2a1ded
commit c3a657a04b
+2
View File
@@ -77,6 +77,8 @@ func init() {
// If omitted, use this base image.
viper.SetDefault("defaultBaseImage", "gcr.io/distroless/static:latest")
viper.SetConfigName(".ko") // .yaml is implicit
viper.SetEnvPrefix("KO")
viper.AutomaticEnv()
if override := os.Getenv("KO_CONFIG_PATH"); override != "" {
viper.AddConfigPath(override)