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