_configuration.tpl 987 B

1234567891011121314151617181920212223242526272829
  1. {{- define "joplin.configuration" -}}
  2. {{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
  3. {{- $dbHost := (printf "%s-postgres" $fullname) -}}
  4. {{- $dbUser := "joplin" -}}
  5. {{- $dbName := "joplin" -}}
  6. {{- $dbPass := randAlphaNum 32 -}}
  7. {{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-postgres-creds" $fullname)) -}}
  8. {{- $dbPass = ((index .data "POSTGRES_PASSWORD") | b64dec) -}}
  9. {{- end -}}
  10. {{/* Temporary set dynamic db details on values,
  11. so we can print them on the notes */}}
  12. {{- $_ := set .Values "joplinDbPass" $dbPass -}}
  13. {{- $_ := set .Values "joplinDbHost" $dbHost -}}
  14. {{- $dbURL := (printf "postgres://%s:%s@%s:5432/%s?sslmode=disable" $dbUser $dbPass $dbHost $dbName) }}
  15. secret:
  16. postgres-creds:
  17. enabled: true
  18. data:
  19. POSTGRES_USER: {{ $dbUser }}
  20. POSTGRES_DB: {{ $dbName }}
  21. POSTGRES_PASSWORD: {{ $dbPass }}
  22. POSTGRES_HOST: {{ $dbHost }}
  23. POSTGRES_URL: {{ $dbURL }}
  24. {{- end -}}