mirror of https://github.com/ehang-io/nps
hot reload
parent
8fa3e8f785
commit
5beee738df
|
@ -17,9 +17,7 @@ import (
|
||||||
_ "github.com/cnlh/nps/web/routers"
|
_ "github.com/cnlh/nps/web/routers"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"syscall"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -36,7 +34,7 @@ func main() {
|
||||||
test.TestServerConfig()
|
test.TestServerConfig()
|
||||||
log.Println("test ok, no error")
|
log.Println("test ok, no error")
|
||||||
return
|
return
|
||||||
case "start", "restart", "stop", "status","reload":
|
case "start", "restart", "stop", "status", "reload":
|
||||||
daemon.InitDaemon("nps", common.GetRunPath(), common.GetTmpPath())
|
daemon.InitDaemon("nps", common.GetRunPath(), common.GetTmpPath())
|
||||||
case "install":
|
case "install":
|
||||||
install.InstallNps()
|
install.InstallNps()
|
||||||
|
@ -66,13 +64,5 @@ func main() {
|
||||||
connection.InitConnectionService()
|
connection.InitConnectionService()
|
||||||
crypt.InitTls(filepath.Join(beego.AppPath, "conf", "server.pem"), filepath.Join(beego.AppPath, "conf", "server.key"))
|
crypt.InitTls(filepath.Join(beego.AppPath, "conf", "server.pem"), filepath.Join(beego.AppPath, "conf", "server.key"))
|
||||||
tool.InitAllowPort()
|
tool.InitAllowPort()
|
||||||
s := make(chan os.Signal, 1)
|
|
||||||
signal.Notify(s, syscall.SIGUSR1)
|
|
||||||
go func() {
|
|
||||||
for {
|
|
||||||
<-s
|
|
||||||
beego.LoadAppConfig("ini", filepath.Join(common.GetRunPath(), "conf", "nps.conf"))
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
server.StartNewServer(bridgePort, task, beego.AppConfig.String("bridge_type"))
|
server.StartNewServer(bridgePort, task, beego.AppConfig.String("bridge_type"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
|
package daemon
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/cnlh/nps/lib/common"
|
||||||
|
"github.com/cnlh/nps/vender/github.com/astaxie/beego"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"path/filepath"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
s := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(s, syscall.SIGUSR1)
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
<-s
|
||||||
|
beego.LoadAppConfig("ini", filepath.Join(common.GetRunPath(), "conf", "nps.conf"))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
Loading…
Reference in New Issue