-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfig.go
32 lines (26 loc) · 834 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
package main
import (
"github.com/BurntSushi/toml"
"log"
)
type HiveConfig struct {
Maxprocs int `toml:"maxprocs"`
Dbinfo map[string]*dbinfo `toml:"dbinfo"`
ManagerPort string `toml:"managerport"`
Port string `toml:"port"`
Loglevel uint8 `toml:"loglevel"`
SchedulePidFile string `toml:"schedule_pid_file"`
WorkerPidFile string `toml:"worker_pid_file"`
CpuProfName string `toml:"cpuprof"`
MemProfName string `toml:"memprof"`
}
type dbinfo struct {
Dbtype string
Conn string
}
func LoadHiveConfig(configPath string) (config *HiveConfig) {
if _, err := toml.DecodeFile(configPath, &config); err != nil {
log.Fatal("Error reading config: ", err)
}
return config
}