add init redis func.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-04-22 23:01:01 +08:00
parent 9a609aa5fe
commit a8116a8ccb
2 changed files with 16 additions and 12 deletions

View File

@ -7,6 +7,6 @@ RUN mkdir -p /tmp/build
Add build.tar.gz /tmp/build/
WORKDIR /tmp/build
RUN go get -v -d
RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w" -o bin/gorush gorush.go
RUN GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/gorush gorush.go
CMD tar -C bin -czf - gorush

View File

@ -44,12 +44,7 @@ func initApp() {
RushStatus.Android.PushError = 0
}
// InitAppStatus for initialize app status
func InitAppStatus() {
switch PushConf.Stat.Engine {
case "memory":
initApp()
case "redis":
func initRedis() {
RedisClient = redis.NewClient(&redis.Options{
Addr: PushConf.Stat.Redis.Addr,
Password: PushConf.Stat.Redis.Password,
@ -61,6 +56,15 @@ func InitAppStatus() {
RushStatus.Ios.PushError = getIosError()
RushStatus.Android.PushSuccess = getAndroidSuccess()
RushStatus.Android.PushError = getAndroidError()
}
// InitAppStatus for initialize app status
func InitAppStatus() {
switch PushConf.Stat.Engine {
case "memory":
initApp()
case "redis":
initRedis()
default:
initApp()
}