feat: add new flag --pid
This commit is contained in:
		
							parent
							
								
									fd22832e7c
								
							
						
					
					
						commit
						015a23d3ec
					
				| 
						 | 
					@ -25,17 +25,14 @@ _testmain.go
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gin-bin
 | 
					gin-bin
 | 
				
			||||||
key.pem
 | 
					key.pem
 | 
				
			||||||
config.yml
 | 
					 | 
				
			||||||
bin/*
 | 
					bin/*
 | 
				
			||||||
.DS_Store
 | 
					.DS_Store
 | 
				
			||||||
gorush/log/*.log
 | 
					gorush/log/*.log
 | 
				
			||||||
build.tar.gz
 | 
					 | 
				
			||||||
gorush.tar.gz
 | 
					 | 
				
			||||||
gorush.db
 | 
					gorush.db
 | 
				
			||||||
vendor
 | 
					vendor
 | 
				
			||||||
Dockerfile.tmp
 | 
					Dockerfile.tmp
 | 
				
			||||||
.cover
 | 
					.cover
 | 
				
			||||||
*.pid
 | 
					 | 
				
			||||||
*.db*
 | 
					*.db*
 | 
				
			||||||
coverage.txt
 | 
					coverage.txt
 | 
				
			||||||
dist
 | 
					dist
 | 
				
			||||||
 | 
					custom
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								main.go
								
								
								
								
							
							
						
						
									
										14
									
								
								main.go
								
								
								
								
							| 
						 | 
					@ -36,10 +36,11 @@ Usage: gorush [options]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Server Options:
 | 
					Server Options:
 | 
				
			||||||
    -p, --port <port>                Use port for clients (default: 8088)
 | 
					    -p, --port <port>                Use port for clients (default: 8088)
 | 
				
			||||||
    -c, --config <file>              Configuration file
 | 
					    -c, --config <file>              Configuration file path
 | 
				
			||||||
    -m, --message <message>          Notification message
 | 
					    -m, --message <message>          Notification message
 | 
				
			||||||
    -t, --token <token>              Notification token
 | 
					    -t, --token <token>              Notification token
 | 
				
			||||||
    --proxy <proxy>                  Proxy URL (only for GCM)
 | 
					    --proxy <proxy>                  Proxy URL (only for GCM)
 | 
				
			||||||
 | 
					    --pid <pid path>                 Process identifier path
 | 
				
			||||||
iOS Options:
 | 
					iOS Options:
 | 
				
			||||||
    -i, --key <file>                 certificate key file path
 | 
					    -i, --key <file>                 certificate key file path
 | 
				
			||||||
    -P, --password <password>        certificate key password
 | 
					    -P, --password <password>        certificate key password
 | 
				
			||||||
| 
						 | 
					@ -93,8 +94,9 @@ func main() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	flag.BoolVar(&showVersion, "version", false, "Print version information.")
 | 
						flag.BoolVar(&showVersion, "version", false, "Print version information.")
 | 
				
			||||||
	flag.BoolVar(&showVersion, "v", false, "Print version information.")
 | 
						flag.BoolVar(&showVersion, "v", false, "Print version information.")
 | 
				
			||||||
	flag.StringVar(&configFile, "c", "", "Configuration file.")
 | 
						flag.StringVar(&configFile, "c", "", "Configuration file path.")
 | 
				
			||||||
	flag.StringVar(&configFile, "config", "", "Configuration file.")
 | 
						flag.StringVar(&configFile, "config", "", "Configuration file path.")
 | 
				
			||||||
 | 
						flag.StringVar(&opts.Core.PID.Path, "pid", "", "PID file path.")
 | 
				
			||||||
	flag.StringVar(&opts.Ios.KeyPath, "i", "", "iOS certificate key file path")
 | 
						flag.StringVar(&opts.Ios.KeyPath, "i", "", "iOS certificate key file path")
 | 
				
			||||||
	flag.StringVar(&opts.Ios.KeyPath, "key", "", "iOS certificate key file path")
 | 
						flag.StringVar(&opts.Ios.KeyPath, "key", "", "iOS certificate key file path")
 | 
				
			||||||
	flag.StringVar(&opts.Ios.Password, "P", "", "iOS certificate password for gorush")
 | 
						flag.StringVar(&opts.Ios.Password, "P", "", "iOS certificate password for gorush")
 | 
				
			||||||
| 
						 | 
					@ -237,6 +239,12 @@ func main() {
 | 
				
			||||||
		gorush.LogError.Fatal(err)
 | 
							gorush.LogError.Fatal(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if opts.Core.PID.Path != "" {
 | 
				
			||||||
 | 
							gorush.PushConf.Core.PID.Path = opts.Core.PID.Path
 | 
				
			||||||
 | 
							gorush.PushConf.Core.PID.Enabled = true
 | 
				
			||||||
 | 
							gorush.PushConf.Core.PID.Override = true
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err = createPIDFile(); err != nil {
 | 
						if err = createPIDFile(); err != nil {
 | 
				
			||||||
		gorush.LogError.Fatal(err)
 | 
							gorush.LogError.Fatal(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue