add redis config.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-04-22 15:47:14 +08:00
parent 0ef8384d54
commit b690825cd4
2 changed files with 26 additions and 0 deletions

View File

@ -30,3 +30,10 @@ log:
access_level: "debug"
error_log: "stderr"
error_level: "error"
stat:
engine: "memory"
redis:
addr: "localhost:6379"
password: ""
db: "0"

View File

@ -13,6 +13,7 @@ type ConfYaml struct {
Android SectionAndroid `yaml:"android"`
Ios SectionIos `yaml:"ios"`
Log SectionLog `yaml:"log"`
Stat SectionStat `yaml:stat`
}
// SectionCore is sub seciont of config.
@ -58,6 +59,19 @@ type SectionLog struct {
ErrorLevel string `yaml:"error_level"`
}
// SectionStat is sub seciont of config.
type SectionStat struct {
Engine string `yaml:"service"`
Redis SectionRedis `yaml:"redis"`
}
// SectionRedis is sub seciont of config.
type SectionRedis struct {
Addr string `yaml:"addr"`
Password string `yaml:"password"`
DB string `yaml:"db"`
}
// BuildDefaultPushConf is default config setting.
func BuildDefaultPushConf() ConfYaml {
var conf ConfYaml
@ -95,6 +109,11 @@ func BuildDefaultPushConf() ConfYaml {
conf.Log.ErrorLog = "stderr"
conf.Log.ErrorLevel = "error"
conf.Stat.Engine = "memory"
conf.Stat.Redis.Addr = "localhost:6379"
conf.Stat.Redis.Password = ""
conf.Stat.Redis.DB = "0"
return conf
}