Skip to content

Commit

Permalink
chore: re-add CONTROLLER_DEVELOPMENT_MODE env support (#40)
Browse files Browse the repository at this point in the history
Co-authored-by: Jintao Zhang <[email protected]>
  • Loading branch information
pmalek and tao12345666333 authored Mar 20, 2024
1 parent 3e96327 commit a66e5ab
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modules/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ func New() *CLI {
flagSet.BoolVar(&deferCfg.Version, "version", false, "Print version information.")

developmentModeEnabled := manager.DefaultConfig().DevelopmentMode
if v := os.Getenv(envVarFlagPrefix + "DEVELOPMENT_MODE"); v == "true" { // TODO: clean env handling https://github.com/Kong/gateway-operator/issues/19
// TODO: clean env handling https://github.com/Kong/gateway-operator-archive/issues/19
if os.Getenv(envVarFlagPrefix+"DEVELOPMENT_MODE") == "true" ||
os.Getenv("CONTROLLER_DEVELOPMENT_MODE") == "true" {
developmentModeEnabled = true
}
loggerOpts := lo.ToPtr(*manager.DefaultConfig().LoggerOpts)
Expand Down Expand Up @@ -116,12 +118,15 @@ func (c *CLI) bindEnvVarsToFlags() (err error) {
// by the program. It returns config for controller manager.
func (c *CLI) Parse(arguments []string) manager.Config {
developmentModeEnabled := manager.DefaultConfig().DevelopmentMode
if v := os.Getenv(envVarFlagPrefix + "DEVELOPMENT_MODE"); v == "true" { // TODO: clean env handling https://github.com/Kong/gateway-operator/issues/19
// TODO: clean env handling https://github.com/Kong/gateway-operator-archive/issues/19
if os.Getenv(envVarFlagPrefix+"DEVELOPMENT_MODE") == "true" ||
os.Getenv("CONTROLLER_DEVELOPMENT_MODE") == "true" {
developmentModeEnabled = true
}

webhookCertDir := manager.DefaultConfig().WebhookCertDir
if certDir := os.Getenv("WEBHOOK_CERT_DIR"); certDir != "" { // TODO: clean env handling https://github.com/Kong/gateway-operator/issues/19
// TODO: clean env handling https://github.com/Kong/gateway-operator-archive/issues/19
if certDir := os.Getenv("WEBHOOK_CERT_DIR"); certDir != "" {
webhookCertDir = certDir
}

Expand Down

0 comments on commit a66e5ab

Please sign in to comment.