-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
33 lines (29 loc) · 831 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
package github_webhook_action
import "github.com/BurntSushi/toml"
var Conf ConfigTOML
type ConfigTOML struct {
Name string `toml:"Name"`
BuildTime string `toml:"BuildTime"`
Server struct {
Port int `toml:"Port"`
LogLevel string `toml:"LogLevel"`
LogIsJSONFormat bool `toml:"LogIsJsonFormat"`
WebhookSecretKey string `toml:"WebhookSecretKey"`
} `toml:"server"`
Action struct {
API struct {
Enable bool `toml:"Enable"`
Mothod string `toml:"Mothod"`
Auth string `toml:"Auth"`
URL string `toml:"URL"`
} `toml:"api"`
Target []struct {
RepoName string `toml:"RepoName"`
TargetID int `toml:"TargetID"`
RequestBody string `toml:"RequestBody"`
} `toml:"target"`
} `toml:"action"`
}
func LoadConfig() {
toml.DecodeFile("config.toml", &Conf)
}