diff --git a/main.go b/main.go
index 3c80f6e..a715767 100644
--- a/main.go
+++ b/main.go
@@ -24,77 +24,6 @@ func checkInput(token, message string) {
}
}
-// Version control for gorush.
-var Version = "No Version Provided"
-
-var usageStr = `
- ________ .__
- / _____/ ____ _______ __ __ ______| |__
-/ \ ___ / _ \\_ __ \| | \/ ___/| | \
-\ \_\ \( <_> )| | \/| | /\___ \ | Y \
- \______ / \____/ |__| |____//____ >|___| /
- \/ \/ \/
-
-Usage: gorush [options]
-
-Server Options:
- -A, --address
Address to bind (default: any)
- -p, --port Use port for clients (default: 8088)
- -c, --config Configuration file path
- -m, --message Notification message
- -t, --token Notification token
- -e, --engine Storage engine (memory, redis ...)
- --title Notification title
- --proxy Proxy URL (only for GCM)
- --pid Process identifier path
- --redis-addr Redis addr (default: localhost:6379)
-iOS Options:
- -i, --key certificate key file path
- -P, --password certificate key password
- --topic iOS topic
- --ios enabled iOS (default: false)
- --production iOS production mode (default: false)
-Android Options:
- -k, --apikey Android API Key
- --android enabled android (default: false)
-Common Options:
- -h, --help Show this message
- -v, --version Show version
-`
-
-// usage will print out the flag options for the server.
-func usage() {
- fmt.Printf("%s\n", usageStr)
- os.Exit(0)
-}
-
-func createPIDFile() error {
- if !gorush.PushConf.Core.PID.Enabled {
- return nil
- }
-
- pidPath := gorush.PushConf.Core.PID.Path
- _, err := os.Stat(pidPath)
- if os.IsNotExist(err) || gorush.PushConf.Core.PID.Override {
- currentPid := os.Getpid()
- if err := os.MkdirAll(filepath.Dir(pidPath), os.ModePerm); err != nil {
- return fmt.Errorf("Can't create PID folder on %v", err)
- }
-
- file, err := os.Create(pidPath)
- if err != nil {
- return fmt.Errorf("Can't create PID file: %v", err)
- }
- defer file.Close()
- if _, err := file.WriteString(strconv.FormatInt(int64(currentPid), 10)); err != nil {
- return fmt.Errorf("Can'write PID information on %s: %v", pidPath, err)
- }
- } else {
- return fmt.Errorf("%s already exists", pidPath)
- }
- return nil
-}
-
func main() {
opts := config.ConfYaml{}
@@ -321,3 +250,74 @@ func main() {
gorush.LogError.Fatal(err)
}
}
+
+// Version control for gorush.
+var Version = "No Version Provided"
+
+var usageStr = `
+ ________ .__
+ / _____/ ____ _______ __ __ ______| |__
+/ \ ___ / _ \\_ __ \| | \/ ___/| | \
+\ \_\ \( <_> )| | \/| | /\___ \ | Y \
+ \______ / \____/ |__| |____//____ >|___| /
+ \/ \/ \/
+
+Usage: gorush [options]
+
+Server Options:
+ -A, --address Address to bind (default: any)
+ -p, --port Use port for clients (default: 8088)
+ -c, --config Configuration file path
+ -m, --message Notification message
+ -t, --token Notification token
+ -e, --engine Storage engine (memory, redis ...)
+ --title Notification title
+ --proxy Proxy URL (only for GCM)
+ --pid Process identifier path
+ --redis-addr Redis addr (default: localhost:6379)
+iOS Options:
+ -i, --key certificate key file path
+ -P, --password certificate key password
+ --topic iOS topic
+ --ios enabled iOS (default: false)
+ --production iOS production mode (default: false)
+Android Options:
+ -k, --apikey Android API Key
+ --android enabled android (default: false)
+Common Options:
+ -h, --help Show this message
+ -v, --version Show version
+`
+
+// usage will print out the flag options for the server.
+func usage() {
+ fmt.Printf("%s\n", usageStr)
+ os.Exit(0)
+}
+
+func createPIDFile() error {
+ if !gorush.PushConf.Core.PID.Enabled {
+ return nil
+ }
+
+ pidPath := gorush.PushConf.Core.PID.Path
+ _, err := os.Stat(pidPath)
+ if os.IsNotExist(err) || gorush.PushConf.Core.PID.Override {
+ currentPid := os.Getpid()
+ if err := os.MkdirAll(filepath.Dir(pidPath), os.ModePerm); err != nil {
+ return fmt.Errorf("Can't create PID folder on %v", err)
+ }
+
+ file, err := os.Create(pidPath)
+ if err != nil {
+ return fmt.Errorf("Can't create PID file: %v", err)
+ }
+ defer file.Close()
+ if _, err := file.WriteString(strconv.FormatInt(int64(currentPid), 10)); err != nil {
+ return fmt.Errorf("Can'write PID information on %s: %v", pidPath, err)
+ }
+ } else {
+ return fmt.Errorf("%s already exists", pidPath)
+ }
+ return nil
+}