apply settings even if section doesn't exist
in response to issue #7. Not sure why this wasn't the original behaviour, nor how I hadn't noticed it earlier
This commit is contained in:
@@ -950,8 +950,11 @@ func (app *appContext) ModifyConfig(gc *gin.Context) {
|
||||
gc.BindJSON(&req)
|
||||
tempConfig, _ := ini.Load(app.config_path)
|
||||
for section, settings := range req {
|
||||
_, err := tempConfig.GetSection(section)
|
||||
if section != "restart-program" && err == nil {
|
||||
if section != "restart-program" {
|
||||
_, err := tempConfig.GetSection(section)
|
||||
if err != nil {
|
||||
tempConfig.NewSection(section)
|
||||
}
|
||||
for setting, value := range settings.(map[string]interface{}) {
|
||||
tempConfig.Section(section).Key(setting).SetValue(value.(string))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user