-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.go
More file actions
74 lines (63 loc) · 2.21 KB
/
config.go
File metadata and controls
74 lines (63 loc) · 2.21 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package config
// DefaultConfig provides the default config values that are used when no config file is specified
// Please keep defaults.ini in sync with this so there isn't any confusion
var DefaultConfig = []byte(`
app_mode = production
listen_addr = 0.0.0.0:8080
use_mock_data = false
[chef]
server_url = http://localhost/organizations/example/
username = example
key_file = /path/to/example.pem
ssl_verify = true
[logging]
level = info
output = stdout
format = json
request_logging = true
log_health_checks = true
[server]
base_path = /
trusted_proxies =
`)
type chefConfig struct {
ServerURL string `mapstructure:"server_url"`
Username string `mapstructure:"username"`
KeyFile string `mapstructure:"key_file"`
SSLVerify bool `mapstructure:"ssl_verify"`
}
type appConfig struct {
AppMode string `mapstructure:"app_mode"`
ListenAddr string `mapstructure:"listen_addr"`
UseMockData bool `mapstructure:"use_mock_data"`
}
type loggingConfig struct {
Level string `mapstructure:"level"`
Output string `mapstructure:"output"`
Format string `mapstructure:"format"`
RequestLogging bool `mapstructure:"request_logging"`
LogHealthChecks bool `mapstructure:"log_health_checks"`
}
type serverConfig struct {
BasePath string `mapstructure:"base_path"`
EnableGzip bool `mapstructure:"enable_gzip"`
TrustedProxies string `mapstructure:"trusted_proxies"`
}
type customLinksConfig struct {
Nodes map[int]customLink `mapstructure:"nodes"`
Environments map[int]customLink `mapstructure:"environments"` // Unused, but maybe in the future
Roles map[int]customLink `mapstructure:"roles"` // Unused, but maybe in the future
DataBags map[int]customLink `mapstructure:"data_bags"` // Unused, but maybe in the future
}
type customLink struct {
Title string `mapstructure:"title"`
Href string `mapstructure:"href"`
NewTab bool `mapstructure:"new_tab"`
}
type Config struct {
App appConfig `mapstructure:"default"`
Chef chefConfig `mapstructure:"chef"`
Logging loggingConfig `mapstructure:"logging"`
Server serverConfig `mapstructure:"server"`
CustomLinks customLinksConfig `mapstructure:"custom_links"`
}