From a88f752f891b1a2a0289d4a671c6b531dbdd470d Mon Sep 17 00:00:00 2001 From: Tolga Ozen Date: Wed, 10 Jul 2024 17:14:21 +0300 Subject: [PATCH] feat: env variables for new log config fields --- pkg/cmd/flags/serve.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/pkg/cmd/flags/serve.go b/pkg/cmd/flags/serve.go index 69e50d7bd..cfa983918 100644 --- a/pkg/cmd/flags/serve.go +++ b/pkg/cmd/flags/serve.go @@ -145,6 +145,48 @@ func RegisterServeFlags(flags *pflag.FlagSet) { panic(err) } + if err = viper.BindPFlag("logger.enabled", flags.Lookup("log-enabled")); err != nil { + panic(err) + } + if err = viper.BindEnv("logger.enabled", "PERMIFY_LOG_ENABLED"); err != nil { + panic(err) + } + + if err = viper.BindPFlag("logger.exporter", flags.Lookup("log-exporter")); err != nil { + panic(err) + } + if err = viper.BindEnv("logger.exporter", "PERMIFY_LOG_EXPORTER"); err != nil { + panic(err) + } + + if err = viper.BindPFlag("logger.endpoint", flags.Lookup("log-endpoint")); err != nil { + panic(err) + } + if err = viper.BindEnv("logger.endpoint", "PERMIFY_LOG_ENDPOINT"); err != nil { + panic(err) + } + + if err = viper.BindPFlag("logger.insecure", flags.Lookup("log-insecure")); err != nil { + panic(err) + } + if err = viper.BindEnv("logger.insecure", "PERMIFY_LOG_INSECURE"); err != nil { + panic(err) + } + + if err = viper.BindPFlag("logger.urlpath", flags.Lookup("log-urlpath")); err != nil { + panic(err) + } + if err = viper.BindEnv("logger.urlpath", "PERMIFY_LOG_URL_PATH"); err != nil { + panic(err) + } + + if err = viper.BindPFlag("logger.headers", flags.Lookup("log-headers")); err != nil { + panic(err) + } + if err = viper.BindEnv("logger.headers", "PERMIFY_LOG_HEADERS"); err != nil { + panic(err) + } + // AUTHN if err = viper.BindPFlag("authn.enabled", flags.Lookup("authn-enabled")); err != nil { panic(err)