-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
44 lines (35 loc) · 916 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
41
42
43
44
package main
import (
"os"
"github.com/pelletier/go-toml"
)
func (k *Kantoku) loadConfig() error {
file, err := os.Open("kantoku.toml")
if err != nil {
return err
}
return toml.NewDecoder(file).Decode(&k.Config)
}
type Config struct {
Kantoku KantokuConfig `toml:"kantoku"`
}
type KantokuConfig struct {
PublicKey string `toml:"public_key"`
Server ServerConfig `toml:"server"`
Nats NatsConfig `toml:"nats"`
Logging LoggingConfig `toml:"logging"`
}
type ServerConfig struct {
Host string `toml:"host"`
Port int64 `toml:"port"`
ExposeTestRoute bool `toml:"expose_test_route"`
}
type NatsConfig struct {
Servers []string `toml:"servers"`
Subject string `toml:"subject"`
NoResponders *interface{} `toml:"no_responders"`
}
type LoggingConfig struct {
TimeFormat string `toml:"time_format"`
Level string `toml:"level"`
}