support android key and ios cert path flag.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
bf703d3e20
commit
88c36ad5dc
27
main.go
27
main.go
|
@ -11,6 +11,8 @@ import (
|
||||||
func main() {
|
func main() {
|
||||||
version := flag.Bool("v", false, "gopush version")
|
version := flag.Bool("v", false, "gopush version")
|
||||||
confPath := flag.String("c", "", "yaml configuration file path for gopush")
|
confPath := flag.String("c", "", "yaml configuration file path for gopush")
|
||||||
|
certificateKeyPath := flag.String("i", "", "iOS certificate key file path for gopush")
|
||||||
|
apiKey := flag.String("k", "", "Android api key configuration for gopush")
|
||||||
port := flag.String("p", "", "port number for gopush")
|
port := flag.String("p", "", "port number for gopush")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
@ -37,6 +39,17 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if gopush.PushConf.Ios.Enabled {
|
if gopush.PushConf.Ios.Enabled {
|
||||||
|
|
||||||
|
if *certificateKeyPath != "" {
|
||||||
|
gopush.PushConf.Ios.PemKeyPath = *certificateKeyPath
|
||||||
|
}
|
||||||
|
|
||||||
|
if gopush.PushConf.Ios.PemKeyPath == "" {
|
||||||
|
log.Println("iOS certificate path not define")
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
gopush.CertificatePemIos, err = certificate.FromPemFile(gopush.PushConf.Ios.PemKeyPath, "")
|
gopush.CertificatePemIos, err = certificate.FromPemFile(gopush.PushConf.Ios.PemKeyPath, "")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -52,6 +65,20 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check andorid api key exist
|
||||||
|
if gopush.PushConf.Android.Enabled {
|
||||||
|
|
||||||
|
if *apiKey != "" {
|
||||||
|
gopush.PushConf.Android.ApiKey = *apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
if gopush.PushConf.Android.ApiKey == "" {
|
||||||
|
log.Println("Android API Key not define")
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// overwrite server port
|
// overwrite server port
|
||||||
if *port != "" {
|
if *port != "" {
|
||||||
gopush.PushConf.Core.Port = *port
|
gopush.PushConf.Core.Port = *port
|
||||||
|
|
Loading…
Reference in New Issue