forked from MemeLabs/overrustlelogs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
51 lines (43 loc) · 1.13 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
47
48
49
50
51
package common
import (
"log"
"github.com/BurntSushi/toml"
)
// Config settings
type Config struct {
DestinyGG struct {
LogHost string `toml:"logHost"`
SocketURL string `toml:"socketURL"`
OriginURL string `toml:"originURL"`
Cookie string `toml:"cookie"`
} `toml:"destinyGG"`
Twitch struct {
LogHost string `toml:"logHost"`
SocketURL string `toml:"socketURL"`
OriginURL string `toml:"originURL"`
ClientID string `toml:"clientID"`
OAuth string `toml:"oAuth"`
Nick string `toml:"nick"`
Admins []string `toml:"admins"`
CommandChannel string `toml:"commandChannel"`
} `toml:"twitch"`
Bot struct {
Admins []string `toml:"admins"`
} `toml:"bot"`
LogHost string `toml:"logHost"`
MaxOpenLogs int `toml:"maxOpenLogs"`
}
var config *Config
// SetupConfig loads config data from json
func SetupConfig(path string) *Config {
config = &Config{}
_, err := toml.DecodeFile(path, &config)
if err != nil {
log.Fatalf("error parsing config, err : %v", err)
}
return config
}
// GetConfig returns config
func GetConfig() *Config {
return config
}