mirror of
https://github.com/truenas/charts.git
synced 2026-04-23 18:10:06 +08:00
* initial commit * add metadata * add readme * add common * extend upgrade_strategy * add initial templates * add qs * fix path * fix typo * quote nums * add some integrations * try dobule underscore * add service lists and test variable * update quetsions * double is the one * add passive port range on ftpd * fix webdav * formatting * https * test plugin too * services * remove todo * add data storage * fix portal, ui and services * only if there are defined
35 lines
1.4 KiB
Smarty
35 lines
1.4 KiB
Smarty
{{- define "sftgo.validation" -}}
|
|
{{- $ports := list -}}
|
|
{{- $ports = append $ports .Values.sftpgoNetwork.webPort -}}
|
|
|
|
{{- range $k, $v := .Values.sftpgoNetwork -}}
|
|
{{- if (hasSuffix "Services" $k) -}}
|
|
{{- range $idx, $svc := $v -}}
|
|
{{- if $svc.enabled -}}
|
|
{{- $ports = append $ports $svc.port -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- if gt (len $ports) 20 -}} {{/* Arbitrary limit, to avoid overallocating ports */}}
|
|
{{- fail (printf "SFTPGo - Too many ports defined, max 20 ports can be defined [%s]" (join ", " $ports)) -}}
|
|
{{- end -}}
|
|
|
|
{{- if not (deepEqual ($ports | uniq) $ports) -}}
|
|
{{- fail (printf "SFTPGo - Expected ports to be unique for all services, ports defined [%s]" (join ", " $ports)) -}}
|
|
{{- end -}}
|
|
|
|
{{- if .Values.sftpgoNetwork.ftpdServices -}}
|
|
{{- with .Values.sftpgoNetwork.ftpdPassivePortRange -}}
|
|
{{- if ge (int .start) (int .end) -}}
|
|
{{- fail (printf "SFTPGo - ftpd passive port range start [%d] must be less than end [%d]" (int .start) (int .end)) -}}
|
|
{{- end -}}
|
|
|
|
{{- if ge (sub (int .end) (int .start)) 20 -}} {{/* Arbitrary limit, to avoid overallocating ports */}}
|
|
{{- fail (printf "SFTPGo - ftpd passive port range must be less than 20 ports, start [%d] end [%d]" (int .start) (int .end)) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|