set ios and android as disabled mode.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-03-27 21:07:11 +08:00
parent 2e0673a32d
commit 59beeb7183
4 changed files with 15 additions and 4 deletions

View File

@ -18,9 +18,8 @@ docker_build: clean
tar -zcvf build.tar.gz gopush.go gopush
docker build -t $(BUILD_IMAGE) -f docker/Dockerfile.build .
docker run $(BUILD_IMAGE) > bin.tar.gz
-rm -rf build.tar.gz
tar -zxvf bin.tar.gz
-rm -rf bin.tar.gz
-rm -rf bin.tar.gz build.tar.gz
clean:
rm -rf build.tar.gz bin.tar.gz bin/*

View File

@ -36,6 +36,12 @@ func main() {
}
}
if !gopush.PushConf.Ios.Enabled && !gopush.PushConf.Android.Enabled {
log.Printf("Note: Please enable iOS or Android config in yaml config")
return
}
if gopush.PushConf.Ios.Enabled {
if *certificateKeyPath != "" {

View File

@ -48,10 +48,10 @@ func BuildDefaultPushConf() ConfYaml {
// Android
conf.Android.ApiKey = ""
conf.Android.Enabled = true
conf.Android.Enabled = false
// iOS
conf.Ios.Enabled = true
conf.Ios.Enabled = false
conf.Ios.PemCertPath = "cert.pem"
conf.Ios.PemKeyPath = "key.pem"
conf.Ios.Production = false

View File

@ -86,8 +86,14 @@ func pushNotification(notification RequestPushNotification) bool {
switch notification.Platform {
case PlatFormIos:
if !PushConf.Ios.Enabled {
return false
}
success = pushNotificationIos(notification)
case PlatFormAndroid:
if !PushConf.Android.Enabled {
return false
}
success = pushNotificationAndroid(notification)
}