+ if *apiAddr != "" {
+ sh := mobius.NewAPIServer(srv, reloadFunc, slogger)
+ go sh.Serve(*apiAddr)
+ }
+
+ go func() {
+ for {
+ sig := <-sigChan
+ switch sig {
+ case syscall.SIGHUP:
+ slogger.Info("SIGHUP received. Reloading configuration.")
+
+ reloadFunc()
+ default:
+ signal.Stop(sigChan)
+ cancel()
+ os.Exit(0)
+ }
+
+ }
+ }()
+
+ slogger.Info("Hotline server started",
+ "version", version,
+ "config", *configDir,
+ "API port", fmt.Sprintf("%s:%v", *netInterface, *basePort),
+ "Transfer port", fmt.Sprintf("%s:%v", *netInterface, *basePort+1),
+ )
+
+ // Assign functions to handle specific Hotline transaction types
+ mobius.RegisterHandlers(srv)
+
+ // Serve Hotline requests until program exit
+ log.Fatal(srv.ListenAndServe(ctx))
+}
+
+func configSearchPaths() string {
+ for _, cfgPath := range mobius.ConfigSearchOrder {
+ if _, err := os.Stat(cfgPath); err == nil {
+ return cfgPath
+ }