aboutsummaryrefslogtreecommitdiff
blob: cc0ce319099037670f424bc3f1a7ecf2ea40b566 (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package config

import "os"

func PortDir() string {
	return getEnv("SOKO_PORT_DIR", "/mnt/packages-tree/gentoo")
}

func PostgresUser() string {
	return getEnv("SOKO_POSTGRES_USER", "root")
}

func PostgresPass() string {
	return getEnv("SOKO_POSTGRES_PASS", "root")
}

func PostgresDb() string {
	return getEnv("SOKO_POSTGRES_DB", "soko")
}

func PostgresHost() string {
	return getEnv("SOKO_POSTGRES_HOST", "db")
}

func PostgresPort() string {
	return getEnv("SOKO_POSTGRES_PORT", "5432")
}

func Debug() string {
	return getEnv("SOKO_DEBUG", "false")
}

func Quiet() string {
	return getEnv("SOKO_QUIET", "false")
}

func LogFile() string {
	return getEnv("SOKO_LOG_FILE", "/var/log/soko/errors.log")
}

func Version() string {
	return getEnv("SOKO_VERSION", "v0.1.8")
}

func Port() string {
	return getEnv("SOKO_PORT", "5000")
}

func CacheControl() string {
	return getEnv("SOKO_CACHE_CONTROL", "max-age=300")
}

func getEnv(key string, fallback string) string {
	if os.Getenv(key) != "" {
		return os.Getenv(key)
	} else {
		return fallback
	}
}