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:
authorIgor <iwiedler@gitlab.com>2020-07-02 12:43:46 +0300
committerAlessio Caiazza <acaiazza@gitlab.com>2020-07-02 12:43:46 +0300
commitcce0e98799eab450dd7d12b9e9180d0d37084c13 (patch)
tree4bb3b201c30abbc574cd3e2e1fe1443740d47907
parent16a5f6937c067c541eb0ecc8b6a6879ea6c0cb60 (diff)
fix default value for gitlab-server to include scheme and port
-rw-r--r--config_test.go14
-rw-r--r--main.go10
2 files changed, 14 insertions, 10 deletions
diff --git a/config_test.go b/config_test.go
index a13f1188..dc200d1c 100644
--- a/config_test.go
+++ b/config_test.go
@@ -16,31 +16,31 @@ func TestGitLabServerFromFlags(t *testing.T) {
}{
{
name: "When gitLabServer is set",
- gitLabServer: "gitlabserver.com",
- gitLabAuthServer: "authserver.com",
+ gitLabServer: "https://gitlabserver.com",
+ gitLabAuthServer: "https://authserver.com",
artifactsServer: "https://artifactsserver.com",
- expected: "gitlabserver.com",
+ expected: "https://gitlabserver.com",
},
{
name: "When auth server is set",
gitLabServer: "",
- gitLabAuthServer: "authserver.com",
+ gitLabAuthServer: "https://authserver.com",
artifactsServer: "https://artifactsserver.com",
- expected: "authserver.com",
+ expected: "https://authserver.com",
},
{
name: "When only artifacts server is set",
gitLabServer: "",
gitLabAuthServer: "",
artifactsServer: "https://artifactsserver.com",
- expected: "artifactsserver.com",
+ expected: "https://artifactsserver.com",
},
{
name: "When only artifacts server includes path",
gitLabServer: "",
gitLabAuthServer: "",
artifactsServer: "https://artifactsserver.com:8080/api/path",
- expected: "artifactsserver.com",
+ expected: "https://artifactsserver.com:8080",
}}
for _, test := range tests {
diff --git a/main.go b/main.go
index 75578913..c5c2047d 100644
--- a/main.go
+++ b/main.go
@@ -15,7 +15,6 @@ import (
log "github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/labkit/errortracking"
- "gitlab.com/gitlab-org/gitlab-pages/internal/host"
"gitlab.com/gitlab-org/gitlab-pages/internal/logging"
"gitlab.com/gitlab-org/gitlab-pages/internal/request"
"gitlab.com/gitlab-org/gitlab-pages/internal/tlsconfig"
@@ -107,8 +106,13 @@ func gitlabServerFromFlags() string {
return *gitLabAuthServer
}
- url, _ := url.Parse(*artifactsServer)
- return host.FromString(url.Host)
+ u, err := url.Parse(*artifactsServer)
+ if err != nil {
+ return ""
+ }
+
+ u.Path = ""
+ return u.String()
}
func internalGitLabServerFromFlags() string {