_portal.tpl 892 B

1234567891011121314151617181920212223242526272829303132333435
  1. {{- define "twofauth.portal" -}}
  2. {{- $host := "$node_ip" -}}
  3. {{- $port := "" -}}
  4. {{- $protocol := "http" -}}
  5. {{- if hasPrefix "https://" .Values.twofauthConfig.appUrl -}}
  6. {{- $protocol = "https" -}}
  7. {{- end -}}
  8. {{- with .Values.twofauthConfig.appUrl -}} {{/* Trim protocol and trailing slash */}}
  9. {{- $host = . | trimPrefix "https://" | trimPrefix "http://" | trimSuffix "/" -}}
  10. {{- if contains ":" $host -}}
  11. {{- $port = (split ":" $host)._1 -}}
  12. {{- $host = (split ":" $host)._0 -}}
  13. {{- end -}}
  14. {{- if not $port -}}
  15. {{- if eq $protocol "https" -}}
  16. {{- $port = "443" -}}
  17. {{- else -}}
  18. {{- $port = "80" -}}
  19. {{- end -}}
  20. {{- end -}}
  21. {{- end }}
  22. ---
  23. apiVersion: v1
  24. kind: ConfigMap
  25. metadata:
  26. name: portal
  27. data:
  28. path: "/"
  29. port: {{ $port | quote }}
  30. protocol: {{ $protocol }}
  31. host: {{ $host }}
  32. {{- end -}}