diff --git a/internal/deprecatedargs/deprecatedargs.go b/internal/deprecatedargs/deprecatedargs.go index 56219e4751e40ec549cb23a8a0806bb86edde260..9bc5a04968557217afc25bf887de28c64e53caee 100644 --- a/internal/deprecatedargs/deprecatedargs.go +++ b/internal/deprecatedargs/deprecatedargs.go @@ -13,7 +13,12 @@ func Validate(args []string) error { argMap := make(map[string]bool) for _, arg := range args { - argMap[arg] = true + keyValue := strings.Split(arg, "=") + if len(keyValue) >= 1 { + argMap[keyValue[0]] = true + } else { + argMap[arg] = true + } } for _, deprecatedArg := range deprecatedArgs { diff --git a/internal/deprecatedargs/deprecatedargs_test.go b/internal/deprecatedargs/deprecatedargs_test.go index b1ebeb41fcbfcad1d36e16f75161b09d66445ef0..d301ec3b9f274c744367a53821aac411b329b99d 100644 --- a/internal/deprecatedargs/deprecatedargs_test.go +++ b/internal/deprecatedargs/deprecatedargs_test.go @@ -22,6 +22,8 @@ func TestInvalidParms(t *testing.T) { "Auth secret passed": []string{"gitlab-pages", "-auth-secret", "abc123"}, "Sentry DSN passed": []string{"gitlab-pages", "-sentry-dsn", "abc123"}, "Multiple keys passed": []string{"gitlab-pages", "-auth-client-id", "abc123", "-auth-client-secret", "abc123"}, + "key=value": []string{"gitlab-pages", "-auth-client-id=abc123"}, + "multiple key=value": []string{"gitlab-pages", "-auth-client-id=abc123", "-auth-client-secret=abc123"}, } for name, args := range tests { diff --git a/main.go b/main.go index 9a316c5e512d752315509c4b66533373fd0c6d72..e2219ea9677274c0fee29837c474ccd7deb07bbf 100644 --- a/main.go +++ b/main.go @@ -58,14 +58,14 @@ var ( _ = flag.String("admin-https-listener", "", "DEPRECATED") _ = flag.String("admin-https-cert", "", "DEPRECATED") _ = flag.String("admin-https-key", "", "DEPRECATED") - secret = flag.String("auth-secret", "", "Cookie store hash key, should be at least 32 bytes long.") + secret = flag.String("auth-secret", "", "Cookie store hash key, should be at least 32 bytes long; will be deprecated soon") gitLabAuthServer = flag.String("auth-server", "", "DEPRECATED, use gitlab-server instead. GitLab server, for example https://www.gitlab.com") gitLabServer = flag.String("gitlab-server", "", "GitLab server, for example https://www.gitlab.com") gitLabAPISecretKey = flag.String("api-secret-key", "", "File with secret key used to authenticate with the GitLab API") gitlabClientHTTPTimeout = flag.Duration("gitlab-client-http-timeout", 10*time.Second, "GitLab API HTTP client connection timeout in seconds (default: 10s)") gitlabClientJWTExpiry = flag.Duration("gitlab-client-jwt-expiry", 30*time.Second, "JWT Token expiry time in seconds (default: 30s)") - clientID = flag.String("auth-client-id", "", "GitLab application Client ID") - clientSecret = flag.String("auth-client-secret", "", "GitLab application Client Secret") + clientID = flag.String("auth-client-id", "", "GitLab application Client ID; will be deprecated soon") + clientSecret = flag.String("auth-client-secret", "", "GitLab application Client Secret; will be deprecated soon") redirectURI = flag.String("auth-redirect-uri", "", "GitLab application redirect URI") maxConns = flag.Uint("max-conns", 5000, "Limit on the number of concurrent connections to the HTTP, HTTPS or proxy listeners") insecureCiphers = flag.Bool("insecure-ciphers", false, "Use default list of cipher suites, may contain insecure ones like 3DES and RC4") @@ -231,7 +231,7 @@ func initErrorReporting(sentryDSN, sentryEnvironment string) { func loadConfig() appConfig { if err := deprecatedargs.Validate(os.Args[1:]); err != nil { - log.WithError(err) + log.WithError(err).Warn("Using deprecated arguments") } config := configFromFlags()