- Better settings tree structure logged using `qdm12/gotree` - Read settings from environment variables, then files, then secret files - Settings methods to default them, merge them and override them - `DNS_PLAINTEXT_ADDRESS` default changed to `127.0.0.1` to use DoT. Warning added if set to something else. - `HTTPPROXY_LISTENING_ADDRESS` instead of `HTTPPROXY_PORT` (with retro-compatibility)
30 lines
596 B
Go
30 lines
596 B
Go
package env
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/qdm12/gluetun/internal/configuration/settings"
|
|
)
|
|
|
|
func (r *Reader) readVPN() (vpn settings.VPN, err error) {
|
|
vpn.Type = os.Getenv("VPN_TYPE")
|
|
|
|
vpn.Provider, err = r.readProvider(vpn.Type)
|
|
if err != nil {
|
|
return vpn, fmt.Errorf("cannot read provider settings: %w", err)
|
|
}
|
|
|
|
vpn.OpenVPN, err = r.readOpenVPN()
|
|
if err != nil {
|
|
return vpn, fmt.Errorf("cannot read OpenVPN settings: %w", err)
|
|
}
|
|
|
|
vpn.Wireguard, err = readWireguard()
|
|
if err != nil {
|
|
return vpn, fmt.Errorf("cannot read Wireguard settings: %w", err)
|
|
}
|
|
|
|
return vpn, nil
|
|
}
|