Verified Commit 69f78e0e authored by Hugo's avatar Hugo
Browse files

secret gen

parent 823a607e
{{ $name := print (include "fqdn" .) "-app" }}
{{ $secretName := print (include "fqdn" .) "-app" }}
{{ $secret := lookup "v1" "Secret" .Release.Namespace $secretName }}
{{ $pgSecretName := print "hedgedoc.pg-" .Release.Namespace ".credentials" }}
{{ $pgSecret := lookup "v1" "Secret" .Release.Namespace $pgSecretName }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $name }}
name: {{ $secretName }}
type: Opaque
stringData:
{{ $secretName := print "hedgedoc.pg-" .Release.Namespace ".credentials" }}
{{ $secret := lookup "v1" "Secret" .Release.Namespace $secretName }}
{{ required (print $secretName " not found") $secret.username }}
CMD_DB_URL: postgres://{{ $secret.data.username }}:{{ $secret.data.password }}@pg-{{ .Release.Namespace }}:5432/hedgedoc
{{- if .Release.IsInstall }}
CMD_SESSION_SECRET: {{ randAlphaNum 16 }}
{{- if $pgSecret.data }}
CMD_DB_URL: postgres://{{ $pgSecret.data.username }}:{{ $pgSecret.data.password }}@pg-{{ .Release.Namespace }}:5432/hedgedoc
{{ else }}
CMD_DB_URL: postgres://unknown:unknown@pg-{{ .Release.Namespace }}:5432/hedgedoc
{{- end }}
{{- if $secret.data }}
CMD_SESSION_SECRET: {{ $secret.data.CMD_SESSION_SECRET | default randAlphaNum 16 }}
{{ else }}
CMD_SESSION_SECRET: {{ (lookup "v1" "Secret" .Release.Namespace $name).data.CMD_SESSION_SECRET }}
{{ end }}
\ No newline at end of file
CMD_SESSION_SECRET: {{ randAlphaNum 16 }}
{{- end }}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment