Skip to content

Commit

Permalink
Updating NOMINATIM_DATABASE_DSN format (#97)
Browse files Browse the repository at this point in the history
* Updated DSN Format. Renaming postgres ENV variable for clarity

* Reverting Chart.lock as that is not in question here.

* Reverting change to Chart.yaml as that is also not in question
  • Loading branch information
ccrpc-fjunge authored Feb 1, 2025
1 parent e21a99d commit 18e22b9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions charts/nominatim/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ Create the database URL.
postgresql://{{ include "nominatim.databaseUser" . }}:{{ include "nominatim.databasePassword" . }}@{{ include "nominatim.databaseHost" . }}:{{ include "nominatim.databasePort" . }}/{{ include "nominatim.databaseName" . }}
{{- end }}

{{/*
Create the database DSN.
*/}}
{{- define "nominatim.databaseDSN" -}}
pgsql:dbname={{ include "nominatim.databaseName" . }};host={{ include "nominatim.databaseHost" . }};port={{ include "nominatim.databasePort" . }};user={{ include "nominatim.databaseUser" . }};password={{ include "nominatim.databasePassword" . }}
{{- end }}

{{- define "nominatim.containerPort" -}}
{{- ternary 80 8080 .Values.nominatimUi.enabled -}}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/nominatim/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ spec:
name: {{ .Values.externalDatabase.existingSecretDsn }}
key: {{ .Values.externalDatabase.existingSecretDsnKey }}
{{- else }}
value: {{ include "nominatim.databaseUrl" . }}
value: {{ include "nominatim.databaseDSN" . }}
{{- end }}
{{- if .Values.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
Expand Down
8 changes: 4 additions & 4 deletions charts/nominatim/templates/initJob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- name: wait-for-db
image: postgres
env:
- name: NOMINATIM_DATABASE_DSN
- name: NOMINATIM_DATABASE_URL
{{- if .Values.externalDatabase.existingSecretDsn }}
valueFrom:
secretKeyRef:
Expand All @@ -42,8 +42,8 @@ spec:
- /bin/bash
- -c
- |
echo $NOMINATIM_DATABASE_DSN;
until pg_isready -d $NOMINATIM_DATABASE_DSN; do
echo $NOMINATIM_DATABASE_URL;
until pg_isready -d $NOMINATIM_DATABASE_URL; do
echo "Waiting for database..."
sleep 2
done
Expand Down Expand Up @@ -128,7 +128,7 @@ spec:
name: {{ .Values.externalDatabase.existingSecretDsn }}
key: {{ .Values.externalDatabase.existingSecretDsnKey }}
{{- else }}
value: {{ include "nominatim.databaseUrl" . }}
value: {{ include "nominatim.databaseDSN" . }}
{{- end }}
{{- if .Values.flatnode.enabled }}
- name: NOMINATIM_FLATNODE_FILE
Expand Down
2 changes: 1 addition & 1 deletion charts/nominatim/templates/updatesJob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ spec:
key: {{ .Values.externalDatabase.existingSecretDsnKey }}
{{- end }}
{{- if not .Values.externalDatabase.existingSecretDsn }}
value: {{ include "nominatim.databaseUrl" . }}
value: {{ include "nominatim.databaseDSN" . }}
{{- end }}
- name: NOMINATIM_REPLICATION_URL
value: {{ .Values.updates.replicationUrl }}
Expand Down

0 comments on commit 18e22b9

Please sign in to comment.