git.iko.soy/typeable/oauth2-proxy
on master help sign in
Ensure config flags get parsed correctly when other flags preceed them
ae17e38Joel Speed
CHANGELOG.md+1
@@ -9,6 +9,7 @@
9## Changes since v7.0.0
9## Changes since v7.0.0
10
10
11- [#1020](https://github.com/oauth2-proxy/oauth2-proxy/pull/1020) Flatten array-based response headers (@NickMeves)
11- [#1020](https://github.com/oauth2-proxy/oauth2-proxy/pull/1020) Flatten array-based response headers (@NickMeves)
12+- [#1026](https://github.com/oauth2-proxy/oauth2-proxy/pull/1026) Ensure config flags get parsed correctly when other flags preceed them (@JoelSpeed)
12
13
13# V7.0.0
14# V7.0.0
14
15
main.go+5
@@ -20,6 +20,11 @@ func main() {
20 logger.SetFlags(logger.Lshortfile)
20 logger.SetFlags(logger.Lshortfile)
21
21
22 configFlagSet := pflag.NewFlagSet("oauth2-proxy", pflag.ContinueOnError)
22 configFlagSet := pflag.NewFlagSet("oauth2-proxy", pflag.ContinueOnError)
23+
24+ // Because we parse early to determine alpha vs legacy config, we have to
25+ // ignore any unknown flags for now
26+ configFlagSet.ParseErrorsWhitelist.UnknownFlags = true
27+
23 config := configFlagSet.String("config", "", "path to config file")
28 config := configFlagSet.String("config", "", "path to config file")
24 alphaConfig := configFlagSet.String("alpha-config", "", "path to alpha config file (use at your own risk - the structure in this config file may change between minor releases)")
29 alphaConfig := configFlagSet.String("alpha-config", "", "path to alpha config file (use at your own risk - the structure in this config file may change between minor releases)")
25 convertConfig := configFlagSet.Bool("convert-config-to-alpha", false, "if true, the proxy will load configuration as normal and convert existing configuration to the alpha config structure, and print it to stdout")
30 convertConfig := configFlagSet.Bool("convert-config-to-alpha", false, "if true, the proxy will load configuration as normal and convert existing configuration to the alpha config structure, and print it to stdout")