hotfix(env): read some settings with case sensitivity

This commit is contained in:
Quentin McGaw
2023-05-30 12:46:10 +00:00
parent 47593928f9
commit 2c30984a10
18 changed files with 78 additions and 58 deletions

View File

@@ -13,7 +13,7 @@ import (
func (s *Source) readOpenVPNSelection() (
selection settings.OpenVPNSelection, err error) {
confFile := env.Get("OPENVPN_CUSTOM_CONFIG")
confFile := env.Get("OPENVPN_CUSTOM_CONFIG", env.ForceLowercase(false))
if confFile != "" {
selection.ConfFile = &confFile
}
@@ -36,7 +36,7 @@ func (s *Source) readOpenVPNSelection() (
var ErrOpenVPNProtocolNotValid = errors.New("OpenVPN protocol is not valid")
func (s *Source) readOpenVPNProtocol() (tcp *bool, err error) {
envKey, protocol := s.getEnvWithRetro("OPENVPN_PROTOCOL", "PROTOCOL")
envKey, protocol := s.getEnvWithRetro("OPENVPN_PROTOCOL", []string{"PROTOCOL"})
switch strings.ToLower(protocol) {
case "":
@@ -52,7 +52,7 @@ func (s *Source) readOpenVPNProtocol() (tcp *bool, err error) {
}
func (s *Source) readOpenVPNCustomPort() (customPort *uint16, err error) {
key, value := s.getEnvWithRetro("VPN_ENDPOINT_PORT", "PORT", "OPENVPN_PORT")
key, value := s.getEnvWithRetro("VPN_ENDPOINT_PORT", []string{"PORT", "OPENVPN_PORT"})
if value == "" {
return nil, nil //nolint:nilnil
}