mirror of
https://github.com/lwch/natpass
synced 2025-10-29 22:51:43 +08:00
支持后台运行
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user