Skip to content

Commit

Permalink
Merge pull request #1343 from Permify/logs
Browse files Browse the repository at this point in the history
feat: env variables for new log config fields
  • Loading branch information
tolgaOzen authored Jul 10, 2024
2 parents 185fe1e + a88f752 commit ec79d37
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions pkg/cmd/flags/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ec79d37

Please sign in to comment.