summaryrefslogtreecommitdiff
path: root/templates/_helpers.tpl
diff options
context:
space:
mode:
Diffstat (limited to 'templates/_helpers.tpl')
-rw-r--r--templates/_helpers.tpl101
1 files changed, 101 insertions, 0 deletions
diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl
new file mode 100644
index 0000000..c915637
--- /dev/null
+++ b/templates/_helpers.tpl
@@ -0,0 +1,101 @@
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "nitter.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "nitter.fullname" -}}
+{{- if .Values.fullnameOverride }}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- $name := default .Chart.Name .Values.nameOverride }}
+{{- if contains $name .Release.Name }}
+{{- .Release.Name | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "nitter.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{- define "nitter.config" -}}
+[Server]
+address = "0.0.0.0"
+port = 8080
+https = false
+httpMaxConnections = 100
+staticDir = "./public"
+title = "{{ .Values.instanceTitle | default (include "nitter.fullname" .) }}"
+hostname = "{{ get (.Values.ingress.hosts | first) "host" }}"
+
+[Cache]
+listMinutes = 240
+rssMinutes = 10
+redisHost = "{{ .Values.redis.host }}"
+redisPort = {{ .Values.redis.port }}
+redisPassword = "{{ .Values.redis.password }}"
+redisConnections = {{ .Values.redis.connections }}
+redisMaxConnections = {{ .Values.redis.maxConnections }}
+
+[Config]
+hmacKey = "secretkey"
+base64Media = false
+enableRSS = true
+enableDebug = false
+proxy = ""
+proxyAuth = ""
+tokenCount = 10
+
+[Preferences]
+theme = "Nitter"
+replaceTwitter = "{{ .Values.urlReplacements.twitter }}"
+replaceYouTube = "{{ .Values.urlReplacements.youtube }}"
+replaceReddit = "{{ .Values.urlReplacements.reddit }}"
+replaceInstagram = "{{ .Values.urlReplacements.instagram }}"
+proxyVideos = true
+hlsPlayback = false
+infiniteScroll = false
+{{- end }}
+
+{{/*
+Common labels
+*/}}
+{{- define "nitter.labels" -}}
+helm.sh/chart: {{ include "nitter.chart" . }}
+{{ include "nitter.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
+{{/*
+Selector labels
+*/}}
+{{- define "nitter.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "nitter.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end }}
+
+{{/*
+Create the name of the service account to use
+*/}}
+{{- define "nitter.serviceAccountName" -}}
+{{- if .Values.serviceAccount.create }}
+{{- default (include "nitter.fullname" .) .Values.serviceAccount.name }}
+{{- else }}
+{{- default "default" .Values.serviceAccount.name }}
+{{- end }}
+{{- end }}