diff --git a/docker/Dockerfile.build b/docker/Dockerfile.build index 1e3a942..6b90f82 100644 --- a/docker/Dockerfile.build +++ b/docker/Dockerfile.build @@ -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 diff --git a/gorush/status.go b/gorush/status.go index 6e23e7c..ccdc569 100644 --- a/gorush/status.go +++ b/gorush/status.go @@ -44,23 +44,27 @@ func initApp() { RushStatus.Android.PushError = 0 } +func initRedis() { + RedisClient = redis.NewClient(&redis.Options{ + Addr: PushConf.Stat.Redis.Addr, + Password: PushConf.Stat.Redis.Password, + DB: PushConf.Stat.Redis.DB, + }) + + RushStatus.TotalCount = getTotalCount() + RushStatus.Ios.PushSuccess = getIosSuccess() + 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": - RedisClient = redis.NewClient(&redis.Options{ - Addr: PushConf.Stat.Redis.Addr, - Password: PushConf.Stat.Redis.Password, - DB: PushConf.Stat.Redis.DB, - }) - - RushStatus.TotalCount = getTotalCount() - RushStatus.Ios.PushSuccess = getIosSuccess() - RushStatus.Ios.PushError = getIosError() - RushStatus.Android.PushSuccess = getAndroidSuccess() - RushStatus.Android.PushError = getAndroidError() + initRedis() default: initApp() }