diff --git a/server/server.go b/server/server.go index 7281c863..8e877d85 100644 --- a/server/server.go +++ b/server/server.go @@ -105,6 +105,15 @@ func NewServer(config Config) (*Server, error) { gitlabClient = &vcs.GitlabClient{ Client: gitlab.NewClient(nil, config.GitlabToken), } + // Ensure the BaseURL has /api/v4/ appended. We only care about the Scheme + // and Host. GH-229 + u, err := url.Parse(config.GitlabHostname) + if err != nil { + return nil, errors.Wrap(err, "parsing GitLab hostname") + } + if err := gitlabClient.Client.SetBaseURL(fmt.Sprintf("%s://%s/api/v4/", u.Scheme, u.Host)); err != nil { + return nil, err + } } var webhooksConfig []webhooks.Config for _, c := range config.Webhooks {