- // TODO: implement graceful shutdown by closing context
- // c := make(chan os.Signal, 1)
- // signal.Notify(c, os.Interrupt)
- // defer func() {
- // signal.Stop(c)
- // cancel()
- // }()
- // go func() {
- // select {
- // case <-c:
- // cancel()
- // case <-ctx.Done():
- // }
- // }()
-
- basePort := flag.Int("bind", defaultPort, "Bind address and port")
- statsPort := flag.String("stats-port", "", "Enable stats HTTP endpoint on address and port")
- configDir := flag.String("config", defaultConfigPath(), "Path to config root")
- version := flag.Bool("version", false, "print version and exit")
+ sigChan := make(chan os.Signal, 1)
+ signal.Notify(sigChan, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGINT, os.Interrupt)
+
+ netInterface := flag.String("interface", "", "IP addr of interface to listen on. Defaults to all interfaces.")
+ basePort := flag.Int("bind", 5500, "Base Hotline server port. File transfer port is base port + 1.")
+ apiAddr := flag.String("api-addr", "", "Enable HTTP API endpoint on address and port")
+ configDir := flag.String("config", configSearchPaths(), "Path to config root")
+ printVersion := flag.Bool("version", false, "Print version and exit")