fixed [Bug][Paperless] Redis password from secret isn't working #5

This commit is contained in:
Richard Tomik
2025-12-19 09:00:28 +01:00
parent d3cdd77cc6
commit 55d1ce8377
6 changed files with 29 additions and 12 deletions

View File

@ -92,17 +92,26 @@ Redis port
Redis URL
Constructs the Redis URL with optional authentication.
Format: redis://[username]:[password]@host:port/database
When existingSecret is configured, uses environment variable placeholder for password.
*/}}
{{- define "paperless-ngx.redis.url" -}}
{{- $host := include "paperless-ngx.redis.host" . }}
{{- $port := include "paperless-ngx.redis.port" . }}
{{- $database := .Values.redis.external.database | toString }}
{{- $username := .Values.redis.external.username | default "" }}
{{- $password := .Values.redis.external.password | default "" }}
{{- if and $username $password }}
{{- if .Values.redis.external.existingSecret }}
{{- if $username }}
{{- printf "redis://%s:$REDIS_PASSWORD@%s:%s/%s" $username $host $port $database }}
{{- else }}
{{- printf "redis://:$REDIS_PASSWORD@%s:%s/%s" $host $port $database }}
{{- end }}
{{- else if .Values.redis.external.password }}
{{- $password := .Values.redis.external.password }}
{{- if $username }}
{{- printf "redis://%s:%s@%s:%s/%s" $username $password $host $port $database }}
{{- else if $password }}
{{- else }}
{{- printf "redis://:%s@%s:%s/%s" $password $host $port $database }}
{{- end }}
{{- else }}
{{- printf "redis://%s:%s/%s" $host $port $database }}
{{- end }}

View File

@ -73,6 +73,16 @@ spec:
- name: PAPERLESS_REDIS_PREFIX
value: {{ .Values.redis.external.prefix | quote }}
{{- end }}
# Redis password from secret (if configured)
{{- if or .Values.redis.external.existingSecret .Values.redis.external.password }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.redis.external.existingSecret | default (printf "%s-secrets" (include "paperless-ngx.fullname" .)) }}
key: {{ .Values.redis.external.passwordKey | default "redis-password" }}
{{- end }}
- name: PAPERLESS_DBHOST
value: {{ include "paperless-ngx.postgresql.host" . | quote }}
- name: PAPERLESS_DBPORT