Files
chart/community/planka/1.2.18/templates/_portal.tpl
2024-04-11 10:31:41 +00:00

34 lines
1.0 KiB
Smarty

{{- define "planka.portal" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: portal
data:
{{- $protocol := "http" -}}
{{- if hasPrefix "https://" .Values.plankaConfig.baseURL -}}
{{- $protocol = "https" -}}
{{- end -}}
{{- $host := "$node_ip" -}}
{{- $port := .Values.plankaNetwork.webPort -}}
{{- with .Values.plankaConfig.baseURL -}} {{/* Trim protocol and trailing slash */}}
{{- $host = (. | trimPrefix "https://" | trimPrefix "http://" | trimSuffix "/") -}}
{{- $host = mustRegexReplaceAll "(.*):[0-9]+" $host "${1}" -}}
{{- $tempPort := . | trimPrefix $protocol | trimPrefix "://" | trimPrefix $host | trimPrefix ":" -}}
{{- if $tempPort -}}
{{- $port = $tempPort -}}
{{- end -}}
{{- if not $tempPort -}}
{{- if eq $protocol "https" -}}
{{- $port = "443" -}}
{{- else -}}
{{- $port = "80" -}}
{{- end -}}
{{- end -}}
{{- end }}
path: "/"
port: {{ $port | quote }}
protocol: {{ $protocol }}
host: {{ $host }}
{{- end -}}