2022-01-06 06:40:23 -05:00
|
|
|
package env
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/qdm12/gluetun/internal/configuration/settings"
|
2023-05-29 20:43:06 +00:00
|
|
|
"github.com/qdm12/gosettings/sources/env"
|
2022-01-06 06:40:23 -05:00
|
|
|
)
|
|
|
|
|
|
2022-08-26 15:16:51 +00:00
|
|
|
func (s *Source) readOpenVPNSelection() (
|
2022-01-06 06:40:23 -05:00
|
|
|
selection settings.OpenVPNSelection, err error) {
|
2023-06-01 08:22:55 +00:00
|
|
|
selection.ConfFile = s.env.Get("OPENVPN_CUSTOM_CONFIG", env.ForceLowercase(false))
|
2022-01-07 15:12:49 +00:00
|
|
|
|
2024-03-23 14:56:42 +00:00
|
|
|
selection.Protocol = s.env.String("OPENVPN_PROTOCOL", env.RetroKeys("PROTOCOL"))
|
2022-01-06 06:40:23 -05:00
|
|
|
if err != nil {
|
|
|
|
|
return selection, err
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-05 16:25:52 +00:00
|
|
|
selection.CustomPort, err = s.env.Uint16Ptr("VPN_ENDPOINT_PORT",
|
|
|
|
|
env.RetroKeys("PORT", "OPENVPN_PORT"))
|
2022-01-06 06:40:23 -05:00
|
|
|
if err != nil {
|
|
|
|
|
return selection, err
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-26 15:16:51 +00:00
|
|
|
selection.PIAEncPreset = s.readPIAEncryptionPreset()
|
2022-01-06 06:40:23 -05:00
|
|
|
|
|
|
|
|
return selection, nil
|
|
|
|
|
}
|