-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.go
40 lines (34 loc) · 1001 Bytes
/
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
package main
import (
"github.com/BurntSushi/toml"
"github.com/operando/golack"
)
type Config struct {
SlackUpdatePost golack.Slack `toml:"slack_update_post"`
SlackErrorPost golack.Slack `toml:"slack_error_post"`
SlackStartPost golack.Slack `toml:"slack_start_post"`
Webhook golack.Webhook `toml:"webhook"`
Log string `toml:"log"`
SleepTime int `toml:"sleeptime"`
Android Android `toml:"android"`
Ios Ios `toml:"ios"`
Kindle Kindle `toml:"kindle"`
ErrorPost bool `toml:"error_post"`
}
type Android struct {
Package string `toml:"package"`
}
type Ios struct {
Country string `toml:"country"`
AppID string `toml:"app_id"`
}
type Kindle struct {
Asin string `toml:"asin"`
}
func LoadConfig(configPath string, config *Config) (*Config, error) {
_, err := toml.DecodeFile(configPath, config)
if err != nil {
return config, err
}
return config, nil
}