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:
authorKevin <kevin.kengne1@gmail.com>2021-01-20 12:10:32 +0300
committerKevin <kevin.kengne1@gmail.com>2021-01-20 12:10:32 +0300
commit36d0fa96d61ae9edadfd4e610439fd89d0f9feb7 (patch)
tree5ddde54b749d46f6959c7128d238e43ea6571a6b /main.go
parent372394c525abe23d653ab63027f33cda16578ef5 (diff)
Inline error messages not reused
Diffstat (limited to 'main.go')
-rw-r--r--main.go24
1 files changed, 7 insertions, 17 deletions
diff --git a/main.go b/main.go
index f54bfcd7..ae6941ce 100644
--- a/main.go
+++ b/main.go
@@ -94,16 +94,6 @@ var (
header MultiStringFlag
)
-const (
- artifactSchemaUnsupportedErrMsg = "artifacts-server scheme must be either http:// or https://"
- artifactsServerTimeoutValueErrMsg = "artifacts-server-timeout must be greater than or equal to 1"
- clientIDNotDefinedErrMsg = "auth-client-id must be defined if authentication is supported"
- clientSecretNotDefinedErrMsg = "auth-client-secret must be defined if authentication is supported" // #nosec
- gitLabServerNotDefinedErrMsg = "gitlab-server must be defined if authentication is supported"
- redirectURINotDefinedErrMsg = "auth-redirect-uri must be defined if authentication is supported"
- secretNotDefinedErrMsg = "auth-secret must be defined if authentication is supported"
-)
-
func gitlabServerFromFlags() string {
if *gitLabServer != "" {
return *gitLabServer
@@ -139,12 +129,12 @@ func setArtifactsServer(artifactsServer string, artifactsServerTimeout int, conf
// url.Parse ensures that the Scheme attribute is always lower case.
if u.Scheme != request.SchemeHTTP && u.Scheme != request.SchemeHTTPS {
errortracking.Capture(err)
- log.Fatal(artifactSchemaUnsupportedErrMsg)
+ log.Fatal("artifacts-server scheme must be either http:// or https://")
}
if artifactsServerTimeout < 1 {
errortracking.Capture(err)
- log.Fatal(artifactsServerTimeoutValueErrMsg)
+ log.Fatal("artifacts-server-timeout must be greater than or equal to 1")
}
config.ArtifactsServerTimeout = artifactsServerTimeout
@@ -236,19 +226,19 @@ func checkAuthenticationConfig(config appConfig) {
func assertAuthConfig(config appConfig) {
if config.StoreSecret == "" {
- log.Fatal(secretNotDefinedErrMsg)
+ log.Fatal("auth-secret must be defined if authentication is supported")
}
if config.ClientID == "" {
- log.Fatal(clientIDNotDefinedErrMsg)
+ log.Fatal("auth-client-id must be defined if authentication is supported")
}
if config.ClientSecret == "" {
- log.Fatal(clientSecretNotDefinedErrMsg)
+ log.Fatal("auth-client-secret must be defined if authentication is supported")
}
if config.GitLabServer == "" {
- log.Fatal(gitLabServerNotDefinedErrMsg)
+ log.Fatal("gitlab-server must be defined if authentication is supported")
}
if config.RedirectURI == "" {
- log.Fatal(redirectURINotDefinedErrMsg)
+ log.Fatal("auth-redirect-uri must be defined if authentication is supported")
}
}