mirror of
https://github.com/truenas/charts.git
synced 2026-06-28 00:06:45 +08:00
34 lines
1.0 KiB
Smarty
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 -}}
|