From ae17e3840355f27c7a30a6e4d09a510cb0b699ce Mon Sep 17 00:00:00 2001 From: Joel Speed Date: Sat, 6 Feb 2021 15:21:12 +0000 Subject: [PATCH] Ensure config flags get parsed correctly when other flags preceed them --- CHANGELOG.md | 1 + main.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8498a792..b6afa63e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ## Changes since v7.0.0 - [#1020](https://github.com/oauth2-proxy/oauth2-proxy/pull/1020) Flatten array-based response headers (@NickMeves) +- [#1026](https://github.com/oauth2-proxy/oauth2-proxy/pull/1026) Ensure config flags get parsed correctly when other flags preceed them (@JoelSpeed) # V7.0.0 diff --git a/main.go b/main.go index 225fb9af..7b201b23 100644 --- a/main.go +++ b/main.go @@ -20,6 +20,11 @@ func main() { logger.SetFlags(logger.Lshortfile) configFlagSet := pflag.NewFlagSet("oauth2-proxy", pflag.ContinueOnError) + + // Because we parse early to determine alpha vs legacy config, we have to + // ignore any unknown flags for now + configFlagSet.ParseErrorsWhitelist.UnknownFlags = true + config := configFlagSet.String("config", "", "path to config file") 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)") 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")