git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #1026 from oauth2-proxy/fix-flag-loading

Ensure config flags get parsed correctly when other flags preceed them

commitc9d9769f6f7c611371ebfad0ef295014f31772fc authorNick Meves <nick.meves@greenhouse.io> dateSat 6 Feb 2021, 14:49 (6 years ago) parent9df3a75ae17e38
2 files changed+6
CHANGELOG.md+1 main.go+5
CHANGELOG.md+1
@@ -9,6 +9,7 @@
99## Changes since v7.0.0
1010
1111- [#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)
1213
1314# V7.0.0
1415
main.go+5
@@ -20,6 +20,11 @@ func main() {
2020 logger.SetFlags(logger.Lshortfile)
2121
2222 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+
2328 config := configFlagSet.String("config", "", "path to config file")
2429 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)")
2530 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")