Add subdir configuration to configuration live reload

This commit is contained in:
Christian Claus 2018-05-01 20:28:33 +02:00
parent c07f1c3dba
commit 5a284b4c24

View file

@ -99,14 +99,10 @@ func (cfg *Config) updateConfig(e fsnotify.Event) {
r := recover() r := recover()
switch t := r.(type) { switch t := r.(type) {
case string: case string:
err = errors.New(t) log.WithError(errors.New(t)).Error("Error updating configuration. Please restart the server...")
case error: case error:
err = t log.WithError(t).Error("Error updating configuration. Please restart the server...")
default:
err = errors.New("Unknown error")
} }
log.WithError(err).Error("Error updating configuration. Please restart the server...")
}() }()
log.WithField("path", e.Name).Info("Config file changed") log.WithField("path", e.Name).Info("Config file changed")
@ -136,6 +132,10 @@ func (cfg *Config) updateConfig(e fsnotify.Event) {
log.WithField("user", username).Info("Updated password of user") log.WithField("user", username).Info("Updated password of user")
cfg.Users[username].Password = v.Password cfg.Users[username].Password = v.Password
} }
if cfg.Users[username].Subdir != v.Subdir {
log.WithField("user", username).Info("Updated subdir of user")
cfg.Users[username].Subdir = v.Subdir
}
} }
} }