Skip to content

Commit

Permalink
Fix config upgrade process requiring double restart
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Oct 29, 2018
1 parent 224f9c5 commit 29b9e7f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions common/config/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,17 @@ func Default() *Config {
config.WithSource(newLocalSource()),
)}
if save, e := UpgradeConfigsIfRequired(defaultConfig); e == nil && save {
saveConfig(defaultConfig, common.PYDIO_SYSTEM_USERNAME, "Configs upgrades applied")
fmt.Println("[Configs] successfully saved config after upgrade")
e2 := saveConfig(defaultConfig, common.PYDIO_SYSTEM_USERNAME, "Configs upgrades applied")
if e2 != nil {
fmt.Println("[Configs] Error while saving upgraded configs")
} else {
fmt.Println("[Configs] successfully saved config after upgrade - Reloading from source")
}
// RELOAD FULLY FROM SOURCE, TO MAKE SURE IT IS IN SYNC WITH JSON
defaultConfig = &Config{config.NewConfig(
// config.WithSource(newEnvSource()),
config.WithSource(newLocalSource()),
)}
} else if e != nil {
fmt.Errorf("[Configs] something whent wrong while upgrading configs: %s", e.Error())
}
Expand Down

0 comments on commit 29b9e7f

Please sign in to comment.