Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Martinez <jmartinez@gitlab.com>2020-04-21 08:00:05 +0300
committerVladimir Shushlin <v.shushlin@gmail.com>2020-05-08 15:06:07 +0300
commit2d9fda6b31bc405ddace566aba650ff79ebe061e (patch)
tree116ff6e13204215cfc1f5999e052c0ccbc396e2b /internal
parent62c8fd873f1c4150f26cddb3a9d6763d95c13b0a (diff)
Fix deprecated args validation
Fixes check for deprecated arguments to cater for key=value arugments. It also logs the warning if a deprecated flag is used.
Diffstat (limited to 'internal')
-rw-r--r--internal/deprecatedargs/deprecatedargs.go7
-rw-r--r--internal/deprecatedargs/deprecatedargs_test.go2
2 files changed, 8 insertions, 1 deletions
diff --git a/internal/deprecatedargs/deprecatedargs.go b/internal/deprecatedargs/deprecatedargs.go
index 56219e47..9bc5a049 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 b1ebeb41..d301ec3b 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 {