mirror of
https://github.com/truenas/charts.git
synced 2024-04-21 15:21:45 +00:00
update validation
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{{- define "gluetun.validation" -}}
|
||||
{{- $providers := (list "custom" "airvpn" "cyberghost" "expressvpn"
|
||||
"fastestvpn" "hidemyass" "ipvanish") -}}
|
||||
"fastestvpn" "hidemyass" "ipvanish" "ivpn") -}}
|
||||
{{- if not (mustHas .Values.gluetunConfig.provider $providers) -}}
|
||||
{{- fail (printf "Gluetun - Expected [Provider] to be one of [%v], but got [%v]" (join ", " $providers) .Values.gluetunConfig.provider) -}}
|
||||
{{- end -}}
|
||||
@@ -11,13 +11,15 @@
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Included by providers that require OpenVPN credentials */}}
|
||||
{{- define "gluetun.openvpn.creds.required" -}}
|
||||
{{- if not .Values.gluetunConfig.openvpnUser -}}
|
||||
{{- fail (printf "Gluetun - Provider [%v] requires [User] on type [%v]." .Values.gluetunConfig.provider .Values.gluetunConfig.type) -}}
|
||||
{{- end -}}
|
||||
{{- if not .Values.gluetunConfig.openvpnPassword -}}
|
||||
{{- fail (printf "Gluetun - Provider [%v] requires [Password] on type [%v]." .Values.gluetunConfig.provider .Values.gluetunConfig.type) -}}
|
||||
{{/* Included by providers that require specific options */}}
|
||||
{{- define "gluetun.options.required" -}}
|
||||
{{- $options := .options -}}
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
|
||||
{{- range $opt := $options -}}
|
||||
{{- if not (get $rootCtx.Values.gluetunConfig $opt) -}}
|
||||
{{- fail (printf "Gluetun - Provider [%v] requires non-empty [%v] option on type [%v]." $rootCtx.Values.gluetunConfig.provider (title $opt) $rootCtx.Values.gluetunConfig.type) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
{{- define "gluetun.configs.wireguard.env" -}}
|
||||
{{- if not .Values.gluetunConfig.wireguardPrivateKey -}}
|
||||
{{- fail (printf "Gluetun - Expected non empty [Wireguard Private Key] on [%v] provider and [Wireguard] Type" .Values.gluetunConfig.provider) -}}
|
||||
{{- end -}}
|
||||
{{- if not .Values.gluetunConfig.wireguardPresharedKey -}}
|
||||
{{- fail (printf "Gluetun - Expected non empty [Wireguard Preshared Key] on [%v] provider and [Wireguard] Type" .Values.gluetunConfig.provider) -}}
|
||||
{{- end -}}
|
||||
{{- if not .Values.gluetunConfig.wireguardAddresses -}}
|
||||
{{- fail (printf "Gluetun - Expected non empty [Wireguard Addresses] on [%v] provider and [Wireguard] Type" .Values.gluetunConfig.provider) -}}
|
||||
{{- with .Values.gluetunConfig.wireguardPrivateKey }}
|
||||
WIREGUARD_PRIVATE_KEY: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.gluetunConfig.wireguardPresharedKey }}
|
||||
WIREGUARD_PRESHARED_KEY: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.gluetunConfig.wireguardAddresses }}
|
||||
WIREGUARD_ADDRESSES: {{ join "," . }}
|
||||
{{- end }}
|
||||
WIREGUARD_PRIVATE_KEY: {{ .Values.gluetunConfig.wireguardPrivateKey }}
|
||||
WIREGUARD_PRESHARED_KEY: {{ .Values.gluetunConfig.wireguardPresharedKey }}
|
||||
WIREGUARD_ADDRESSES: {{ join "," .Values.gluetunConfig.wireguardAddresses }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
{{/* https://github.com/qdm12/gluetun/wiki/AirVPN */}}
|
||||
{{- define "gluetun.airvpn.openvpn.env" -}}
|
||||
{{/* Continue */}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "gluetun.airvpn.wireguard.env" -}}
|
||||
{{/* Continue */}}
|
||||
{{- include "gluetun.options.required" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"wireguardPrivateKey"
|
||||
"wireguardPresharedKey"
|
||||
"wireguardAddresses")) -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
{{/* https://github.com/qdm12/gluetun/wiki/Cyberghost */}}
|
||||
{{- define "gluetun.cyberghost.openvpn.env" -}}
|
||||
{{- include "gluetun.options.required" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"openvpnUser"
|
||||
"openvpnPassword")) -}}
|
||||
{{- include "gluetun.unsupported.server.options" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"serverRegions"
|
||||
"serverCities"
|
||||
"serverNames")) -}}
|
||||
{{- include "gluetun.openvpn.creds.required" $ -}}
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"serverRegions"
|
||||
"serverCities"
|
||||
"serverNames")) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "gluetun.cyberghost.wireguard.env" -}}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
{{/* https://github.com/qdm12/gluetun/wiki/ExpressVPN */}}
|
||||
{{- define "gluetun.expressvpn.openvpn.env" -}}
|
||||
{{- include "gluetun.options.required" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"openvpnUser"
|
||||
"openvpnPassword")) -}}
|
||||
{{- include "gluetun.unsupported.server.options" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"serverRegions"
|
||||
"serverNames")) -}}
|
||||
{{- include "gluetun.openvpn.creds.required" $ -}}
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"serverRegions"
|
||||
"serverNames")) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "gluetun.expressvpn.wireguard.env" -}}
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
{{/* https://github.com/qdm12/gluetun/wiki/FastestVPN */}}
|
||||
{{- define "gluetun.fastestvpn.openvpn.env" -}}
|
||||
{{- include "gluetun.options.required" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"openvpnUser"
|
||||
"openvpnPassword")) -}}
|
||||
{{- include "gluetun.unsupported.server.options" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"serverRegions"
|
||||
"serverCities"
|
||||
"serverNames")) -}}
|
||||
{{- include "gluetun.openvpn.creds.required" $ -}}
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"serverRegions"
|
||||
"serverCities"
|
||||
"serverNames")) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "gluetun.fastestvpn.wireguard.env" -}}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
{{/* https://github.com/qdm12/gluetun/wiki/Hidemyass */}}
|
||||
{{- define "gluetun.hidemyass.openvpn.env" -}}
|
||||
{{- include "gluetun.options.required" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"openvpnUser"
|
||||
"openvpnPassword")) -}}
|
||||
{{- include "gluetun.unsupported.server.options" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"serverNames")) -}}
|
||||
{{- include "gluetun.openvpn.creds.required" $ -}}
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"serverNames")) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "gluetun.hidemyass.wireguard.env" -}}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
{{/* https://github.com/qdm12/gluetun/wiki/IPVanish */}}
|
||||
{{- define "gluetun.ipvanish.openvpn.env" -}}
|
||||
{{- include "gluetun.options.required" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"openvpnUser"
|
||||
"openvpnPassword")) -}}
|
||||
{{- include "gluetun.unsupported.server.options" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"serverRegions"
|
||||
"serverNames")) -}}
|
||||
{{- include "gluetun.openvpn.creds.required" $ -}}
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"serverRegions"
|
||||
"serverNames")) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "gluetun.ipvanish.wireguard.env" -}}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
{{/* https://github.com/qdm12/gluetun/wiki/IVPN */}}
|
||||
{{- define "gluetun.ivpn.openvpn.env" -}}
|
||||
{{- include "gluetun.options.required" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"openvpnUser")) -}}
|
||||
{{- include "gluetun.unsupported.server.options" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"serverRegions"
|
||||
"serverNames")) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "gluetun.ivpn.wireguard.env" -}}
|
||||
{{- include "gluetun.options.required" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"wireguardPrivateKey"
|
||||
"wireguardAddresses")) -}}
|
||||
{{- include "gluetun.unsupported.server.options" (dict
|
||||
"rootCtx" $
|
||||
"options" (list
|
||||
"serverRegions"
|
||||
"serverNames")) -}}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user