From 7e2ea4d74ddd1fa50acc7011e00fd5f95e800421 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Thu, 13 Jan 2022 15:18:39 +0000 Subject: [PATCH] hotfix(custom): allow empty user and password for OpenVPN --- internal/configuration/settings/openvpn.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/configuration/settings/openvpn.go b/internal/configuration/settings/openvpn.go index 341c72c1..6c3ad339 100644 --- a/internal/configuration/settings/openvpn.go +++ b/internal/configuration/settings/openvpn.go @@ -86,16 +86,18 @@ func (o OpenVPN) validate(vpnProvider string) (err error) { ErrOpenVPNVersionIsNotValid, o.Version, strings.Join(validVersions, ", ")) } - if o.User == "" { + isCustom := vpnProvider == constants.Custom + + if !isCustom && o.User == "" { return ErrOpenVPNUserIsEmpty } - if o.Password == "" { + if !isCustom && o.Password == "" { return ErrOpenVPNPasswordIsEmpty } // Validate ConfFile - if vpnProvider == constants.Custom { + if isCustom { if *o.ConfFile == "" { return fmt.Errorf("%w: no file path specified", ErrOpenVPNConfigFile) }