mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-02 11:56:53 +00:00
Optimizing compatibility
This commit is contained in:
@@ -87,7 +87,7 @@ func StartFromFile(path string) {
|
||||
first := true
|
||||
cnf, err := config.NewConfig(path)
|
||||
if err != nil || cnf.CommonConfig == nil {
|
||||
logs.Error("Config file %s loading error", path)
|
||||
logs.Error("Config file %s loading error %s", path, err.Error())
|
||||
os.Exit(0)
|
||||
}
|
||||
logs.Info("Loading configuration file %s successfully", path)
|
||||
@@ -115,12 +115,12 @@ re:
|
||||
vkey := cnf.CommonConfig.VKey
|
||||
if isPub {
|
||||
// send global configuration to server and get status of config setting
|
||||
if _, err := c.SendConfigInfo(cnf.CommonConfig); err != nil {
|
||||
if _, err := c.SendInfo(cnf.CommonConfig.Client, common.NEW_CONF); err != nil {
|
||||
logs.Error(err)
|
||||
goto re
|
||||
}
|
||||
if !c.GetAddStatus() {
|
||||
logs.Error(errAdd)
|
||||
logs.Error("the web_user may have been occupied!")
|
||||
goto re
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ re:
|
||||
|
||||
//send hosts to server
|
||||
for _, v := range cnf.Hosts {
|
||||
if _, err := c.SendHostInfo(v); err != nil {
|
||||
if _, err := c.SendInfo(v, common.NEW_HOST); err != nil {
|
||||
logs.Error(err)
|
||||
goto re
|
||||
}
|
||||
@@ -146,12 +146,12 @@ re:
|
||||
|
||||
//send task to server
|
||||
for _, v := range cnf.Tasks {
|
||||
if _, err := c.SendTaskInfo(v); err != nil {
|
||||
if _, err := c.SendInfo(v, common.NEW_TASK); err != nil {
|
||||
logs.Error(err)
|
||||
goto re
|
||||
}
|
||||
if !c.GetAddStatus() {
|
||||
logs.Error(errAdd, v.Ports)
|
||||
logs.Error(errAdd, v.Ports, v.Remark)
|
||||
goto re
|
||||
}
|
||||
if v.Mode == "file" {
|
||||
@@ -166,7 +166,11 @@ re:
|
||||
}
|
||||
|
||||
c.Close()
|
||||
logs.Notice("web access login key ", vkey)
|
||||
if cnf.CommonConfig.Client.WebUserName == "" || cnf.CommonConfig.Client.WebPassword == "" {
|
||||
logs.Notice("web access login username:user password:%s", vkey)
|
||||
} else {
|
||||
logs.Notice("web access login username:%s password:%s", cnf.CommonConfig.Client.WebUserName, cnf.CommonConfig.Client.WebPassword)
|
||||
}
|
||||
NewRPClient(cnf.CommonConfig.Server, vkey, cnf.CommonConfig.Tp, cnf.CommonConfig.ProxyUrl, cnf).Start()
|
||||
CloseLocalServer()
|
||||
goto re
|
||||
|
Reference in New Issue
Block a user