_configuration.tpl 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {{- define "listmonk.configuration" -}}
  2. {{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
  3. {{- $dbHost := (printf "%s-postgres" $fullname) -}}
  4. {{- $dbUser := "listmonk" -}}
  5. {{- $dbName := "listmonk" -}}
  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. {{- $dbURL := (printf "postgres://%s:%s@%s:5432/%s?sslmode=disable" $dbUser $dbPass $dbHost $dbName) -}}
  11. {{/* Temporary set dynamic db details on values,
  12. so we can print them on the notes */}}
  13. {{- $_ := set .Values "listmonkDbPass" $dbPass -}}
  14. {{- $_ := set .Values "listmonkDbHost" $dbHost -}}
  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. listmonk-creds:
  25. enabled: true
  26. data:
  27. LISTMONK_app__address: {{ printf "0.0.0.0:%v" .Values.listmonkNetwork.webPort }}
  28. LISTMONK_db__port: "5432"
  29. LISTMONK_db__host: {{ $dbHost }}
  30. LISTMONK_db__user: {{ $dbUser }}
  31. LISTMONK_db__password: {{ $dbPass }}
  32. LISTMONK_db__database: {{ $dbName }}
  33. LISTMONK_db__sslmode: "disable"
  34. LISTMONK_app__admin_username: {{ .Values.listmonkConfig.adminUsername | quote }}
  35. LISTMONK_app__admin_password: {{ .Values.listmonkConfig.adminPassword | quote }}
  36. {{- end -}}