fix(portforward): different validation when vpn is up or not

This commit is contained in:
Quentin McGaw
2023-10-07 12:43:36 +00:00
parent ee413f59a2
commit ec1f252528
3 changed files with 25 additions and 13 deletions

View File

@@ -17,10 +17,11 @@ type Settings struct {
// fields set in the partialUpdate argument, validates the new settings
// and returns them if they are valid, or returns an error otherwise.
// In all cases, the receiving settings are unmodified.
func (s Settings) updateWith(partialUpdate Settings) (updated Settings, err error) {
func (s Settings) updateWith(partialUpdate Settings,
forStartup bool) (updated Settings, err error) {
updated = s.copy()
updated.overrideWith(partialUpdate)
err = updated.validate()
err = updated.validate(forStartup)
if err != nil {
return updated, err
}
@@ -38,6 +39,6 @@ func (s *Settings) overrideWith(update Settings) {
s.Service.OverrideWith(update.Service)
}
func (s Settings) validate() (err error) {
return s.Service.Validate()
func (s Settings) validate(forStartup bool) (err error) {
return s.Service.Validate(forStartup)
}