@@ -10,6 +10,7 @@ import (
10
10
11
11
const DefaultGitHubEndpoint = "https://api.github.com"
12
12
const DefaultGitLabEndpoint = "https://gitlab.com/api/v4"
13
+ const DefaultGitLabTokenType = "oauth"
13
14
14
15
type GitHubConfig struct {
15
16
AccessToken string `envconfig:"ACCESS_TOKEN" json:"access_token,omitempty"`
@@ -18,9 +19,10 @@ type GitHubConfig struct {
18
19
}
19
20
20
21
type GitLabConfig struct {
21
- AccessToken string `envconfig:"ACCESS_TOKEN" json:"access_token,omitempty"`
22
- Endpoint string `envconfig:"ENDPOINT" json:"endpoint"`
23
- Repo string `envconfig:"REPO" json:"repo"` // Should be "owner/repo" format
22
+ AccessToken string `envconfig:"ACCESS_TOKEN" json:"access_token,omitempty"`
23
+ AccessTokenType string `envconfig:"ACCESS_TOKEN_TYPE" json:"access_token_type"`
24
+ Endpoint string `envconfig:"ENDPOINT" json:"endpoint"`
25
+ Repo string `envconfig:"REPO" json:"repo"` // Should be "owner/repo" format
24
26
}
25
27
26
28
// DBConfiguration holds all the database related configuration.
@@ -106,6 +108,11 @@ func LoadConfig(filename string) (*Configuration, error) {
106
108
func (config * Configuration ) ApplyDefaults () {
107
109
if config .GitHub .Endpoint == "" {
108
110
config .GitHub .Endpoint = DefaultGitHubEndpoint
111
+ }
112
+ if config .GitLab .Endpoint == "" {
109
113
config .GitLab .Endpoint = DefaultGitLabEndpoint
110
114
}
115
+ if config .GitLab .AccessTokenType == "" {
116
+ config .GitLab .AccessTokenType = DefaultGitLabTokenType
117
+ }
111
118
}
0 commit comments