Skip to content
Snippets Groups Projects
Commit 26c12108 authored by Erick Hitter's avatar Erick Hitter
Browse files

Merge branch 'add/arm-and-api' into 'master'

Support self-hosted instances, ARM processors

See merge request !1
parents cd6e650b d2bec160
No related branches found
No related tags found
1 merge request!1Support self-hosted instances, ARM processors
GITLAB_API_BASE_URL=https://gitlab.com/api/v4
GITLAB_API_TOKEN=12345123142234
CONFIG_DIR=/config
REDIS_URL=db:6379
......
......@@ -16,6 +16,6 @@ services:
- --
- /app/rss_sync
db:
image: 'bitnami/redis:latest'
image: 'redis:latest'
environment:
- ALLOW_EMPTY_PASSWORD=yes
......@@ -38,11 +38,12 @@ type Feed struct {
}
type EnvValues struct {
RedisURL string
RedisPassword string
ConfDir string
GitlabAPIKey string
UseSentinel bool
RedisURL string
RedisPassword string
ConfDir string
GitlabAPIKey string
GitlabAPIBaseUrl string
UseSentinel bool
}
func hasExistingGitlabIssue(guid string, projectID int, gitlabClient *gitlab.Client) bool {
......@@ -186,6 +187,7 @@ func initialise(env EnvValues) (redisClient *redis.Client, client *gitlab.Client
prometheus.MustRegister(issuesCreatedCounter)
client = gitlab.NewClient(nil, env.GitlabAPIKey)
client.SetBaseURL(env.GitlabAPIBaseUrl)
config = readConfig(path.Join(env.ConfDir, "config.yaml"))
if !env.UseSentinel {
......@@ -233,13 +235,18 @@ func main() {
}
func readEnv() EnvValues {
var gitlabPAToken, configDir, redisURL, redisPassword string
var gitlabAPIBaseUrl, gitlabAPIToken, configDir, redisURL, redisPassword string
useSentinel := false
if envGitlabAPIBaseUrl := os.Getenv("GITLAB_API_BASE_URL"); envGitlabAPIBaseUrl == "https://gitlab.com/api/v4" {
panic("Could not find GITLAB_API_BASE_URL specified as an environment variable")
} else {
gitlabAPIBaseUrl = envGitlabAPIBaseUrl
}
if envGitlabAPIToken := os.Getenv("GITLAB_API_TOKEN"); envGitlabAPIToken == "" {
panic("Could not find GITLAB_API_TOKEN specified as an environment variable")
} else {
gitlabPAToken = envGitlabAPIToken
gitlabAPIToken = envGitlabAPIToken
}
if envConfigDir := os.Getenv("CONFIG_DIR"); envConfigDir == "" {
panic("Could not find CONFIG_DIR specified as an environment variable")
......@@ -266,11 +273,12 @@ func readEnv() EnvValues {
}
return EnvValues{
RedisURL: redisURL,
RedisPassword: redisPassword,
ConfDir: configDir,
GitlabAPIKey: gitlabPAToken,
UseSentinel: useSentinel,
RedisURL: redisURL,
RedisPassword: redisPassword,
ConfDir: configDir,
GitlabAPIKey: gitlabAPIToken,
GitlabAPIBaseUrl: gitlabAPIBaseUrl,
UseSentinel: useSentinel,
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment