aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/gitlab/gitlab.go
diff options
context:
space:
mode:
Diffstat (limited to 'bridge/gitlab/gitlab.go')
-rw-r--r--bridge/gitlab/gitlab.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/bridge/gitlab/gitlab.go b/bridge/gitlab/gitlab.go
index bcc50e4c..9298dc8e 100644
--- a/bridge/gitlab/gitlab.go
+++ b/bridge/gitlab/gitlab.go
@@ -17,9 +17,12 @@ const (
metaKeyGitlabUrl = "gitlab-url"
metaKeyGitlabLogin = "gitlab-login"
metaKeyGitlabProject = "gitlab-project-id"
+ metaKeyGitlabBaseUrl = "gitlab-base-url"
- keyProjectID = "project-id"
+ keyProjectID = "project-id"
+ keyGitlabBaseUrl = "base-url"
+ defaultBaseURL = "https://gitlab.com/"
defaultTimeout = 60 * time.Second
)
@@ -37,10 +40,16 @@ func (*Gitlab) NewExporter() core.Exporter {
return &gitlabExporter{}
}
-func buildClient(token *auth.Token) *gitlab.Client {
- client := &http.Client{
+func buildClient(baseURL string, token *auth.Token) (*gitlab.Client, error) {
+ httpClient := &http.Client{
Timeout: defaultTimeout,
}
- return gitlab.NewClient(client, token.Value)
+ gitlabClient := gitlab.NewClient(httpClient, token.Value)
+ err := gitlabClient.SetBaseURL(baseURL)
+ if err != nil {
+ return nil, err
+ }
+
+ return gitlabClient, nil
}