Skip to content

Commit

Permalink
Merge pull request #124 from chrisdoherty4/feature/remove-deprecated-…
Browse files Browse the repository at this point in the history
…options

Remove deprecated CLI args
  • Loading branch information
mergify[bot] authored Sep 16, 2022
2 parents b59af19 + 3eee76e commit 7328b18
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions cmd/hegel/root_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,6 @@ Examples
--factility HEGEL_FACILITY
--http-port HEGEL_HTTP_PORT
--http-custom-endpoints HEGEL_HTTP_CUSTOM_ENDPOINTS
For backwards compatibility a set of deprecated CLI and environment variables are still supported. Behavior for
specifying both deprecated and current forms is undefined.
Deprecated CLI flags
Deprecated Current
--http_port --http-port
Deprecated environment variables
Deprecated Current
CUSTOM_ENDPOINTS HEGEL_HTTP_CUSTOM_ENDPOINTS
DATA_MODEL_VERSION HEGEL_DATA_MODEL
TRUSTED_PROXIES HEGEL_TRUSTED_PROXIES
`

// EnvNamePrefix defines the environment variable prefix required for all environment configuration.
Expand Down Expand Up @@ -100,10 +87,6 @@ func NewRootCommand() (*RootCommand, error) {
return nil, err
}

if err := rootCmd.configureLegacyFlags(); err != nil {
return nil, err
}

return rootCmd, nil
}

Expand Down Expand Up @@ -194,26 +177,3 @@ func (c *RootCommand) configureFlags() error {

return err
}

func (c *RootCommand) configureLegacyFlags() error {
c.Flags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
switch name {
case "http_port":
return pflag.NormalizedName("http-port")
default:
return pflag.NormalizedName(name)
}
})

for key, envName := range map[string]string{
"data-model": "DATA_MODEL_VERSION",
"http-custom-endpoints": "CUSTOM_ENDPOINTS",
"trusted-proxies": "TRUSTED_PROXIES",
} {
if err := c.vpr.BindEnv(key, envName); err != nil {
return err
}
}

return nil
}

0 comments on commit 7328b18

Please sign in to comment.