all: Refactor preparing configuration (#7127)
This commit is contained in:
@@ -28,6 +28,27 @@ func (opts OptionsConfiguration) Copy() OptionsConfiguration {
|
||||
return optsCopy
|
||||
}
|
||||
|
||||
func (opts *OptionsConfiguration) prepare(guiPWIsSet bool) {
|
||||
util.FillNilSlices(opts)
|
||||
|
||||
opts.RawListenAddresses = util.UniqueTrimmedStrings(opts.RawListenAddresses)
|
||||
opts.RawGlobalAnnServers = util.UniqueTrimmedStrings(opts.RawGlobalAnnServers)
|
||||
|
||||
// Very short reconnection intervals are annoying
|
||||
if opts.ReconnectIntervalS < 5 {
|
||||
opts.ReconnectIntervalS = 5
|
||||
}
|
||||
|
||||
if guiPWIsSet && len(opts.UnackedNotificationIDs) > 0 {
|
||||
for i, key := range opts.UnackedNotificationIDs {
|
||||
if key == "authenticationUserAndPassword" {
|
||||
opts.UnackedNotificationIDs = append(opts.UnackedNotificationIDs[:i], opts.UnackedNotificationIDs[i+1:]...)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// RequiresRestartOnly returns a copy with only the attributes that require
|
||||
// restart on change.
|
||||
func (opts OptionsConfiguration) RequiresRestartOnly() OptionsConfiguration {
|
||||
|
||||
Reference in New Issue
Block a user