feat: support storage engine flag. (#235)

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2017-06-07 02:59:14 -05:00 committed by GitHub
parent d4e021dd0c
commit 304855c5a4
1 changed files with 7 additions and 0 deletions

View File

@ -40,6 +40,7 @@ Server Options:
-c, --config <file> Configuration file path -c, --config <file> Configuration file path
-m, --message <message> Notification message -m, --message <message> Notification message
-t, --token <token> Notification token -t, --token <token> Notification token
-e, --engine <engine> Storage engine (memory, redis ...)
--title <title> Notification title --title <title> Notification title
--proxy <proxy> Proxy URL (only for GCM) --proxy <proxy> Proxy URL (only for GCM)
--pid <pid path> Process identifier path --pid <pid path> Process identifier path
@ -116,6 +117,8 @@ func main() {
flag.StringVar(&opts.Core.Port, "port", "", "port number for gorush") flag.StringVar(&opts.Core.Port, "port", "", "port number for gorush")
flag.StringVar(&token, "t", "", "token string") flag.StringVar(&token, "t", "", "token string")
flag.StringVar(&token, "token", "", "token string") flag.StringVar(&token, "token", "", "token string")
flag.StringVar(&opts.Stat.Engine, "e", "", "store engine")
flag.StringVar(&opts.Stat.Engine, "engine", "", "store engine")
flag.StringVar(&message, "m", "", "notification message") flag.StringVar(&message, "m", "", "notification message")
flag.StringVar(&message, "message", "", "notification message") flag.StringVar(&message, "message", "", "notification message")
flag.StringVar(&title, "title", "", "notification title") flag.StringVar(&title, "title", "", "notification title")
@ -168,6 +171,10 @@ func main() {
gorush.PushConf.Android.APIKey = opts.Android.APIKey gorush.PushConf.Android.APIKey = opts.Android.APIKey
} }
if opts.Stat.Engine != "" {
gorush.PushConf.Stat.Engine = opts.Stat.Engine
}
// overwrite server port // overwrite server port
if opts.Core.Port != "" { if opts.Core.Port != "" {
gorush.PushConf.Core.Port = opts.Core.Port gorush.PushConf.Core.Port = opts.Core.Port