forked from rande/gitlab-ci-helper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
43 lines (35 loc) · 941 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright © 2016 Thomas Rabaix <[email protected]>.
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
package gitlab_ci_helper
import "os"
type GitLabConfig struct {
Host string `json:"host"`
Token string `json:"token"`
ApiPath string `json:"api_path"`
}
type MailerConfig struct {
SubjectPrefix string `json:"subject"`
Sender string `json:"sender"`
Dest []string `json:"dest"`
Host string `json:"host"`
Username string `json:"username"`
Password string `json:"password"`
}
type Config struct {
Gitlab *GitLabConfig `json:"gitlab"`
}
func NewConfig() *Config {
gitlab := &GitLabConfig{
Host: os.Getenv("GITLAB_HOST"),
Token: os.Getenv("GITLAB_TOKEN"),
ApiPath: os.Getenv("GITLAB_API_PATH"),
}
if gitlab.ApiPath == "" {
gitlab.ApiPath = "/api/v3"
}
return &Config{
Gitlab: gitlab,
}
}