@@ -142,8 +142,11 @@ func main() {
142142 // Check if certificates made with Agent <=1.2.7 needs to be moved over the new location
143143 cert .MigrateCertificatesGeneratedWithOldAgentVersions (config .GetCertificatesDir ())
144144
145+ configPath := config .GetConfigPath ()
146+ fmt .Println ("configPath: " , configPath )
147+
145148 // Launch main loop in a goroutine
146- go loop ()
149+ go loop (configPath )
147150
148151 // SetupSystray is the main thread
149152 configDir := config .GetDefaultConfigDir ()
@@ -156,6 +159,7 @@ func main() {
156159 AdditionalConfig : * additionalConfig ,
157160 ConfigDir : configDir ,
158161 }
162+ Systray .SetCurrentConfigFile (configPath )
159163
160164 if src , err := os .Executable (); err != nil {
161165 panic (err )
@@ -166,11 +170,15 @@ func main() {
166170 }
167171}
168172
169- func loop () {
173+ func loop (configPath * paths. Path ) {
170174 if * hibernate {
171175 return
172176 }
173177
178+ if configPath == nil {
179+ log .Panic ("configPath is nil" )
180+ }
181+
174182 log .SetLevel (log .InfoLevel )
175183 log .SetOutput (os .Stdout )
176184
@@ -189,10 +197,6 @@ func loop() {
189197 h .broadcastSys <- mapB
190198 }
191199
192- configPath := config .GetConfigPath ()
193-
194- fmt .Println ("configPath: " , configPath )
195-
196200 // if the default browser is Safari, prompt the user to install HTTPS certificates
197201 // and eventually install them
198202 if runtime .GOOS == "darwin" {
@@ -230,7 +234,6 @@ func loop() {
230234 if err != nil {
231235 log .Panicf ("cannot parse arguments: %s" , err )
232236 }
233- Systray .SetCurrentConfigFile (configPath )
234237
235238 // Parse additional ini config if defined
236239 if len (* additionalConfig ) > 0 {
0 commit comments