File tree 1 file changed +17
-5
lines changed
1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -186,13 +186,25 @@ func loop() {
186
186
srcPath := paths .New (src )
187
187
srcDir := srcPath .Parent ()
188
188
189
- configPath := srcDir . Join ( "config.ini" )
189
+ var configPath * paths. Path
190
190
191
- if configPath .NotExist () {
192
- // probably we are on macOS, where the config is in a different dir
193
- configPath = srcDir .Parent ().Join ("Resources" , "config.ini" )
191
+ // see if the env var is defined, if it is take the config from there
192
+ envConfig := os .Getenv ("ARDUINO_CREATE_AGENT_CONFIG" )
193
+ if envConfig != "" {
194
+ configPath = paths .New (envConfig )
194
195
if configPath .NotExist () {
195
- log .Panicf ("config.ini file not found in %s" , configPath )
196
+ log .Panicf ("config from env var %s does not exists" , envConfig )
197
+ }
198
+ } else {
199
+ // take the config from the folder where the binary sits
200
+ configPath = srcDir .Join ("config.ini" )
201
+
202
+ if configPath .NotExist () {
203
+ // probably we are on macOS, where the config is in a different dir
204
+ configPath = srcDir .Parent ().Join ("Resources" , "config.ini" )
205
+ if configPath .NotExist () {
206
+ log .Panicf ("config.ini file not found in %s" , configPath )
207
+ }
196
208
}
197
209
}
198
210
You can’t perform that action at this time.
0 commit comments