-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathzconfig.go
65 lines (54 loc) · 1.01 KB
/
zconfig.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package gimg
import (
"code.google.com/p/gcfg"
_ "errors"
_ "strings"
)
type AppConfig struct {
System struct {
IsDaemon int
Host string
Port int
Headers string
Etag int
LogOutput string
LogLevel int
LogName string
DisableArgs int
Format string
Quality int
}
Cache struct {
Cache int
MemcacheHost string
MemcachePort int
}
Storage struct {
Mode int
SaveNew int
MaxSize int
AllowedTypes string
ImgPath string
BeansdbHost string
BeansdbPort int
SsdbHost string
SsdbPort int
}
}
// func (a *AppConfig) Types() []string {
// return strings.Split(a.Storage.AllowedTypes, ",")
// }
func LoadConfig(cfgFile string) (AppConfig, error) {
var err error
var cfg AppConfig
// isExists := util.IsExist(cfgFile)
// if !isExists {
// return cfg, errors.New("Config file is not exists!")
// }
err = gcfg.ReadFileInto(&cfg, cfgFile)
if err != nil {
//panic(err)
return cfg, err
}
return cfg, nil
}