forked from jwallet/gitlab-slack-notifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
env.go
41 lines (38 loc) · 798 Bytes
/
env.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
package main
import (
"fmt"
"log"
"os"
"strconv"
)
func getEnvInt(key string) int {
var variable string = os.Getenv(key)
if len(variable) == 0 {
variable = "0"
}
val, err := strconv.Atoi(variable)
if err != nil {
log.Fatal("Failed to convert env var to integer")
}
return val
}
func logEnvs() {
fmt.Printf(`Environment variables:
- PORT: %v
- SLACK_BOT_OAUTH_TOKEN: %v
- SLACK_BOT_NOTIFICATION_COLOR: %v
- SLACK_BOT_NOTIFICATION_GREATINGS: %v
- GITLAB_WEBHOOK_SECRET_TOKEN: %v
- SLACK_EVENT_READ_CHANNEL: %v
- USER_EMAIL_DOMAIN: %v
- USER_EMAIL_SPACE_REPLACER: %v
`,
PORT,
SLACK_BOT_OAUTH_TOKEN,
SLACK_BOT_NOTIFICATION_COLOR,
SLACK_BOT_NOTIFICATION_GREATINGS,
GITLAB_WEBHOOK_SECRET_TOKEN,
SLACK_EVENT_READ_CHANNEL,
USER_EMAIL_DOMAIN,
USER_EMAIL_SPACE_REPLACER)
}