Skip to content
Snippets Groups Projects
Commit fe9115bd authored by Christoph Witzko's avatar Christoph Witzko
Browse files

fix: lowercase configuration parameters

parent 7276f320
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -25,15 +25,15 @@ func TestNewGitlabRepository(t *testing.T) {
repo = &GitLabRepository{}
err = repo.Init(map[string]string{
"token": "token",
"gitlabProjectID": "1",
"gitlab_projectid": "1",
})
require.NoError(err)
repo = &GitLabRepository{}
err = repo.Init(map[string]string{
"gitlabBaseUrl": "https://mygitlab.com",
"gitlab_baseurl": "https://mygitlab.com",
"token": "token",
"gitlabProjectID": "1",
"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,
"gitlab_baseurl": ts.URL,
"token": "gitlab-examples-ci",
"gitlabBranch": "",
"gitlabProjectID": strconv.Itoa(GITLAB_PROJECT_ID),
"gitlab_branch": "",
"gitlab_projectid": strconv.Itoa(GITLAB_PROJECT_ID),
})
require.NoError(t, err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment