hotfix(updater): defaults for settings in CLI mode
This commit is contained in:
@@ -73,6 +73,8 @@ func (c *CLI) Update(ctx context.Context, args []string, logger UpdaterLogger) e
|
||||
options.Providers = strings.Split(csvProviders, ",")
|
||||
}
|
||||
|
||||
options.SetDefaults()
|
||||
|
||||
err := options.Validate()
|
||||
if err != nil {
|
||||
return fmt.Errorf("options validation failed: %w", err)
|
||||
|
||||
@@ -118,7 +118,7 @@ func (s *Settings) SetDefaults() {
|
||||
s.PublicIP.setDefaults()
|
||||
s.Shadowsocks.setDefaults()
|
||||
s.System.setDefaults()
|
||||
s.Updater.setDefaults()
|
||||
s.Updater.SetDefaults()
|
||||
s.Version.setDefaults()
|
||||
s.VPN.setDefaults()
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ func (u *Updater) overrideWith(other Updater) {
|
||||
u.CLI = helpers.MergeWithBool(u.CLI, other.CLI)
|
||||
}
|
||||
|
||||
func (u *Updater) setDefaults() {
|
||||
func (u *Updater) SetDefaults() {
|
||||
u.Period = helpers.DefaultDuration(u.Period, 0)
|
||||
u.DNSAddress = helpers.DefaultIP(u.DNSAddress, net.IPv4(1, 1, 1, 1))
|
||||
u.CLI = helpers.DefaultBool(u.CLI, false)
|
||||
|
||||
Reference in New Issue
Block a user