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) readWireguardSelection() (
|
2022-01-06 06:40:23 -05:00
|
|
|
selection settings.WireguardSelection, err error) {
|
2023-06-05 16:25:52 +00:00
|
|
|
selection.EndpointIP, err = s.env.NetipAddr("VPN_ENDPOINT_IP", env.RetroKeys("WIREGUARD_ENDPOINT_IP"))
|
2022-01-06 06:40:23 -05:00
|
|
|
if err != nil {
|
|
|
|
|
return selection, err
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-05 16:25:52 +00:00
|
|
|
selection.EndpointPort, err = s.env.Uint16Ptr("VPN_ENDPOINT_PORT", env.RetroKeys("WIREGUARD_ENDPOINT_PORT"))
|
2022-01-06 06:40:23 -05:00
|
|
|
if err != nil {
|
|
|
|
|
return selection, err
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-01 08:22:55 +00:00
|
|
|
selection.PublicKey = s.env.String("WIREGUARD_PUBLIC_KEY", env.ForceLowercase(false))
|
2022-01-06 06:40:23 -05:00
|
|
|
|
|
|
|
|
return selection, nil
|
|
|
|
|
}
|