支持后台运行

This commit is contained in:
lwch
2021-08-12 17:56:03 +08:00
parent 6936ba6ea8
commit 203bf8bc0c
4 changed files with 21 additions and 0 deletions

View File

@@ -7,11 +7,15 @@ import (
"natpass/code/server/global"
"os"
"github.com/lwch/daemon"
"github.com/lwch/logging"
"github.com/lwch/runtime"
)
func main() {
bak := flag.Bool("d", false, "backend running")
pid := flag.String("pid", "", "pid file dir")
user := flag.String("u", "", "daemon user")
conf := flag.String("conf", "", "configure file path")
flag.Parse()
@@ -20,6 +24,11 @@ func main() {
os.Exit(1)
}
if *bak {
daemon.Start(0, *pid, *user, "-conf", *conf)
return
}
cfg := global.LoadConf(*conf)
cert, err := tls.LoadX509KeyPair(cfg.TLSCrt, cfg.TLSKey)