From fe9115bd98b54baeece87f88c8f76b5a45a81ea0 Mon Sep 17 00:00:00 2001 From: Christoph Witzko <github@christophwitzko.com> Date: Mon, 17 Aug 2020 13:41:13 +0200 Subject: [PATCH] fix: lowercase configuration parameters --- pkg/provider/gitlab.go | 8 ++++---- pkg/provider/gitlab_test.go | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pkg/provider/gitlab.go b/pkg/provider/gitlab.go index 3e11460..611c804 100644 --- a/pkg/provider/gitlab.go +++ b/pkg/provider/gitlab.go @@ -19,7 +19,7 @@ type GitLabRepository struct { } func (repo *GitLabRepository) Init(config map[string]string) error { - gitlabBaseUrl := config["gitlabBaseUrl"] + gitlabBaseUrl := config["gitlab_baseurl"] if gitlabBaseUrl == "" { gitlabBaseUrl = os.Getenv("CI_SERVER_URL") } @@ -32,17 +32,17 @@ func (repo *GitLabRepository) Init(config map[string]string) error { return errors.New("gitlab token missing") } - branch := config["gitlabBranch"] + branch := config["gitlab_branch"] if branch == "" { branch = os.Getenv("CI_COMMIT_BRANCH") } - projectID := config["gitlabProjectID"] + projectID := config["gitlab_projectid"] if projectID == "" { projectID = os.Getenv("CI_PROJECT_ID") } if projectID == "" { - return fmt.Errorf("gitlabProjectID is required") + return fmt.Errorf("gitlab_projectid is required") } repo.projectID = projectID diff --git a/pkg/provider/gitlab_test.go b/pkg/provider/gitlab_test.go index 11e883a..49b5177 100644 --- a/pkg/provider/gitlab_test.go +++ b/pkg/provider/gitlab_test.go @@ -24,16 +24,16 @@ func TestNewGitlabRepository(t *testing.T) { repo = &GitLabRepository{} err = repo.Init(map[string]string{ - "token": "token", - "gitlabProjectID": "1", + "token": "token", + "gitlab_projectid": "1", }) require.NoError(err) repo = &GitLabRepository{} err = repo.Init(map[string]string{ - "gitlabBaseUrl": "https://mygitlab.com", - "token": "token", - "gitlabProjectID": "1", + "gitlab_baseurl": "https://mygitlab.com", + "token": "token", + "gitlab_projectid": "1", }) require.NoError(err) require.Equal("https://mygitlab.com/api/v4/", repo.client.BaseURL().String(), "invalid custom instance initialization") @@ -117,10 +117,10 @@ func getNewGitlabTestRepo(t *testing.T) (*GitLabRepository, *httptest.Server) { ts := httptest.NewServer(http.HandlerFunc(GitlabHandler)) repo := &GitLabRepository{} err := repo.Init(map[string]string{ - "gitlabBaseUrl": ts.URL, - "token": "gitlab-examples-ci", - "gitlabBranch": "", - "gitlabProjectID": strconv.Itoa(GITLAB_PROJECT_ID), + "gitlab_baseurl": ts.URL, + "token": "gitlab-examples-ci", + "gitlab_branch": "", + "gitlab_projectid": strconv.Itoa(GITLAB_PROJECT_ID), }) require.NoError(t, err) -- GitLab