优化结构
This commit is contained in:
@@ -268,23 +268,7 @@ func (r *Store) watchLoop(watcher *fsnotify.Watcher, stop <-chan struct{}, done
|
||||
// take down a running process or publish invalid state.
|
||||
continue
|
||||
}
|
||||
current := r.Snapshot()
|
||||
if next.Admin == nil {
|
||||
next.Admin = &Admin{}
|
||||
}
|
||||
// Storage and Email move to database-backed integration settings after
|
||||
// first initialization. External config file edits must not erase the
|
||||
// active values when those sections are absent from config.yaml.
|
||||
if current != nil && current.Admin != nil {
|
||||
if next.Admin.Storage == nil {
|
||||
next.Admin.Storage = cloneStorage(current.Admin.Storage)
|
||||
}
|
||||
if next.Admin.Email == nil && current.Admin.Email != nil {
|
||||
email := *current.Admin.Email
|
||||
next.Admin.Email = &email
|
||||
}
|
||||
}
|
||||
r.Replace(next)
|
||||
r.Replace(MergeRuntimeConfig(r.Snapshot(), next))
|
||||
case _, ok := <-errors:
|
||||
// fsnotify errors are intentionally non-fatal; the watcher remains
|
||||
// useful for subsequent events and Close always terminates it.
|
||||
|
||||
Reference in New Issue
Block a user