-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathconfig.go
38 lines (33 loc) · 800 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
// Author: zheng-ji.info
package main
import (
//"fmt"
"io/ioutil"
"launchpad.net/goyaml"
)
// ProxyConfig Type
type ProxyConfig struct {
Bind string `yaml:"bind"`
WaitQueueLen int `yaml:"wait_queue_len"`
MaxConn int `yaml:"max_conn"`
Timeout int `yaml:"timeout"`
FailOver int `yaml:"failover"`
Backend []string `yaml:"backend"`
Log LogConfig `yaml:"log"`
Stats string `yaml:"stats"`
}
// LogConfig Type
type LogConfig struct {
Level string `yaml:"level"`
Path string `yaml:"path"`
}
func parseConfigFile(filepath string) error {
if config, err := ioutil.ReadFile(filepath); err == nil {
if err = goyaml.Unmarshal(config, &pConfig); err != nil {
return err
}
} else {
return err
}
return nil
}