move ConfigLoad into Start function when running as a service
This commit is contained in:
parent
4eea03c9a1
commit
9aeec3478f
|
@ -211,7 +211,7 @@ func findConfigFile(configFile *string) (string, error) {
|
||||||
return path.Join(pwd, *configFile), nil
|
return path.Join(pwd, *configFile), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConfigLoad(proxy *Proxy, svcFlag *string) error {
|
func ConfigLoad(proxy *Proxy) error {
|
||||||
version := flag.Bool("version", false, "print current proxy version")
|
version := flag.Bool("version", false, "print current proxy version")
|
||||||
resolve := flag.String("resolve", "", "resolve a name using system libraries")
|
resolve := flag.String("resolve", "", "resolve a name using system libraries")
|
||||||
list := flag.Bool("list", false, "print the list of available resolvers for the enabled filters")
|
list := flag.Bool("list", false, "print the list of available resolvers for the enabled filters")
|
||||||
|
@ -225,9 +225,6 @@ func ConfigLoad(proxy *Proxy, svcFlag *string) error {
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *svcFlag == "stop" || *svcFlag == "uninstall" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if *version {
|
if *version {
|
||||||
fmt.Println(AppVersion)
|
fmt.Println(AppVersion)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
|
|
@ -56,9 +56,6 @@ func main() {
|
||||||
}
|
}
|
||||||
app.proxy = NewProxy()
|
app.proxy = NewProxy()
|
||||||
_ = ServiceManagerStartNotify()
|
_ = ServiceManagerStartNotify()
|
||||||
if err := ConfigLoad(app.proxy, svcFlag); err != nil {
|
|
||||||
dlog.Fatal(err)
|
|
||||||
}
|
|
||||||
if len(*svcFlag) != 0 {
|
if len(*svcFlag) != 0 {
|
||||||
if svc == nil {
|
if svc == nil {
|
||||||
dlog.Fatal("Built-in service installation is not supported on this platform")
|
dlog.Fatal("Built-in service installation is not supported on this platform")
|
||||||
|
@ -85,6 +82,9 @@ func main() {
|
||||||
dlog.Fatal(err)
|
dlog.Fatal(err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if err := ConfigLoad(app.proxy); err != nil {
|
||||||
|
dlog.Fatal(err)
|
||||||
|
}
|
||||||
app.signalWatch()
|
app.signalWatch()
|
||||||
app.appMain()
|
app.appMain()
|
||||||
}
|
}
|
||||||
|
@ -93,10 +93,15 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *App) Start(service service.Service) error {
|
func (app *App) Start(service service.Service) error {
|
||||||
if err := app.proxy.InitPluginsGlobals(); err != nil {
|
go func() {
|
||||||
dlog.Fatal(err)
|
if err := ConfigLoad(app.proxy); err != nil {
|
||||||
}
|
dlog.Fatal(err)
|
||||||
go app.appMain()
|
}
|
||||||
|
if err := app.proxy.InitPluginsGlobals(); err != nil {
|
||||||
|
dlog.Fatal(err)
|
||||||
|
}
|
||||||
|
app.appMain()
|
||||||
|
}()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue