@@ -166,6 +166,13 @@ var args = acn.ArgumentList{
166166 Type : "int" ,
167167 DefaultValue : "120" ,
168168 },
169+ {
170+ Name : acn .OptStoreFileLocation ,
171+ Shorthand : acn .OptStoreFileLocationAlias ,
172+ Description : "Set store file absolute path" ,
173+ Type : "string" ,
174+ DefaultValue : platform .CNMRuntimePath ,
175+ },
169176}
170177
171178// Prints description and version information.
@@ -195,6 +202,7 @@ func main() {
195202 telemetryEnabled := acn .GetArg (acn .OptTelemetry ).(bool )
196203 httpConnectionTimeout := acn .GetArg (acn .OptHttpConnectionTimeout ).(int )
197204 httpResponseHeaderTimeout := acn .GetArg (acn .OptHttpResponseHeaderTimeout ).(int )
205+ storeFileLocation := acn .GetArg (acn .OptStoreFileLocation ).(string )
198206
199207 if vers {
200208 printVersion ()
@@ -231,16 +239,17 @@ func main() {
231239 // Log platform information.
232240 log .Printf ("Running on %v" , platform .GetOSInfo ())
233241
234- err = acn .CreateDirectory (platform . CNMRuntimePath )
242+ err = acn .CreateDirectory (storeFileLocation )
235243 if err != nil {
236- log .Errorf ("Failed to create File Store directory Error:%v" , err .Error ())
244+ log .Errorf ("Failed to create File Store directory %s, due to Error:%v" , storeFileLocation , err .Error ())
237245 return
238246 }
239247
240248 // Create the key value store.
241- config .Store , err = store .NewJsonFileStore (platform .CNMRuntimePath + name + ".json" )
249+ storeFileName := storeFileLocation + name + ".json"
250+ config .Store , err = store .NewJsonFileStore (storeFileName )
242251 if err != nil {
243- log .Errorf ("Failed to create store: %v\n " , err )
252+ log .Errorf ("Failed to create store file : %s, due to error % v\n " , storeFileName , err )
244253 return
245254 }
246255
@@ -310,9 +319,10 @@ func main() {
310319 }
311320
312321 // Create the key value store.
313- pluginConfig .Store , err = store .NewJsonFileStore (platform .CNMRuntimePath + pluginName + ".json" )
322+ pluginStoreFile := storeFileLocation + pluginName + ".json"
323+ pluginConfig .Store , err = store .NewJsonFileStore (pluginStoreFile )
314324 if err != nil {
315- log .Errorf ("Failed to create store: %v\n " , err )
325+ log .Errorf ("Failed to create plugin store file %s, due to error : %v\n " , pluginStoreFile , err )
316326 return
317327 }
318328
0 commit comments