diff --git a/main.go b/main.go index a83d7f4c..4bda82c0 100755 --- a/main.go +++ b/main.go @@ -142,8 +142,11 @@ func main() { // Check if certificates made with Agent <=1.2.7 needs to be moved over the new location cert.MigrateCertificatesGeneratedWithOldAgentVersions(config.GetCertificatesDir()) + configPath := config.GetConfigPath() + fmt.Println("configPath: ", configPath) + // Launch main loop in a goroutine - go loop() + go loop(configPath) // SetupSystray is the main thread configDir := config.GetDefaultConfigDir() @@ -156,6 +159,7 @@ func main() { AdditionalConfig: *additionalConfig, ConfigDir: configDir, } + Systray.SetCurrentConfigFile(configPath) if src, err := os.Executable(); err != nil { panic(err) @@ -166,11 +170,15 @@ func main() { } } -func loop() { +func loop(configPath *paths.Path) { if *hibernate { return } + if configPath == nil { + log.Panic("configPath is nil") + } + log.SetLevel(log.InfoLevel) log.SetOutput(os.Stdout) @@ -189,10 +197,6 @@ func loop() { h.broadcastSys <- mapB } - configPath := config.GetConfigPath() - - fmt.Println("configPath: ", configPath) - // if the default browser is Safari, prompt the user to install HTTPS certificates // and eventually install them if runtime.GOOS == "darwin" { @@ -230,7 +234,6 @@ func loop() { if err != nil { log.Panicf("cannot parse arguments: %s", err) } - Systray.SetCurrentConfigFile(configPath) // Parse additional ini config if defined if len(*additionalConfig) > 0 {