-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
46 lines (37 loc) · 1.06 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
44
45
46
package config
import (
"github.com/spf13/viper"
)
// IsProd returns whether we're running in production mode.
func IsProd() bool {
return viper.GetBool("prod")
}
// Secret returns the master secret, as a hex string.
// Do not use this key directly; use config/secrets to generate per-task derivative keys.
func Secret() string {
return viper.GetString("secret")
}
// DB returns the database connection string.
func DB() string {
return viper.GetString("db")
}
// Redis returns the redis connection string.
func Redis() string {
return viper.GetString("redis")
}
// RedisKeyspace returns the keyspace for redis, eg. "meow" will prefix all redis keys with "meow:".
func RedisKeyspace() string {
return viper.GetString("redis-keyspace")
}
// NodeID returns the node ID used for distributed snowflake generation.
func NodeID() int64 {
return viper.GetInt64("node-id")
}
// Syntax style for JSON output.
func HighlightStyle() string {
return viper.GetString("highlight-style")
}
// Disable colour in the CLI.
func NoColour() bool {
return viper.GetBool("no-colour")
}