|
@@ -169,6 +169,10 @@ func UpdateConf(values map[string]interface{}) error {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func persistConf(configMap map[string]interface{}) error {
|
|
func persistConf(configMap map[string]interface{}) error {
|
|
|
|
|
+ if BasePath == "" {
|
|
|
|
|
+ // default base path
|
|
|
|
|
+ BasePath = "/opt/nativeplanet/groundseg"
|
|
|
|
|
+ }
|
|
|
// marshal and persist it
|
|
// marshal and persist it
|
|
|
updatedJSON, err := json.MarshalIndent(configMap, "", " ")
|
|
updatedJSON, err := json.MarshalIndent(configMap, "", " ")
|
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -179,7 +183,7 @@ func persistConf(configMap map[string]interface{}) error {
|
|
|
return fmt.Errorf("Error updating global config: %v", err)
|
|
return fmt.Errorf("Error updating global config: %v", err)
|
|
|
}
|
|
}
|
|
|
// write to disk
|
|
// write to disk
|
|
|
- Logger.Info("Persisting configuration to disk %v",string(updatedJSON))
|
|
|
|
|
|
|
+ Logger.Info("Persisting configuration to disk %v",string(updatedJson))
|
|
|
if err := ioutil.WriteFile(confPath, updatedJSON, 0644); err != nil {
|
|
if err := ioutil.WriteFile(confPath, updatedJSON, 0644); err != nil {
|
|
|
return fmt.Errorf("Error writing to file: %v", err)
|
|
return fmt.Errorf("Error writing to file: %v", err)
|
|
|
}
|
|
}
|