diff --git a/config/config.yml b/config/config.yml index 6744425..6d90481 100644 --- a/config/config.yml +++ b/config/config.yml @@ -30,3 +30,10 @@ log: access_level: "debug" error_log: "stderr" error_level: "error" + +stat: + engine: "memory" + redis: + addr: "localhost:6379" + password: "" + db: "0" diff --git a/gorush/config.go b/gorush/config.go index bfb8e00..5af31a7 100644 --- a/gorush/config.go +++ b/gorush/config.go @@ -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 }