-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
43 lines (37 loc) · 1.18 KB
/
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 (c) 42Crunch Ltd. All rights reserved.
Licensed under the GNU Affero General Public License version 3. See LICENSE.txt in the project root for license information.
*/
package main
import (
"log"
"os"
"strconv"
)
func readEnvConfig() {
namespace = os.Getenv("NAMESPACE")
if namespace == "" {
log.Fatal("ERROR, no NAMESPACE env variable is set")
}
platformService = os.Getenv("PLATFORM_SERVICE")
if platformService == "" {
log.Printf("No PLATFORM_SERVICE env variable is set, using default: %s", defaultplatformService)
platformService = defaultplatformService
}
scandImage = os.Getenv("SCAND_IMAGE")
if scandImage == "" {
log.Printf("No SCAND_IMAGE env variable is set, using default: %s", defaultScandImage)
scandImage = defaultScandImage
}
expirationTime := os.Getenv("EXPIRATION_TIME")
if expirationTime == "" {
log.Printf("No EXPIRATION_TIME env variable is set, using default: %d", defaultExpirationTime)
expirationTimeInt = defaultExpirationTime
} else {
var err error
expirationTimeInt, err = strconv.ParseInt(expirationTime, 10, 32)
if err != nil {
log.Fatalf("ERROR, invalid EXPIRATION_TIME env var: '%s': %s", expirationTime, err)
}
}
}