mirror of
https://github.com/GothenburgBitFactory/taskchampion-sync-server.git
synced 2026-07-16 16:35:41 +00:00
Auto add UUIDs when starting postgres
This commit is contained in:
committed by
Dustin J. Mitchell
parent
269efce4f1
commit
d7d9de3bbe
@ -38,6 +38,13 @@ spec:
|
|||||||
key: connection
|
key: connection
|
||||||
- name: SCHEMA_URL
|
- name: SCHEMA_URL
|
||||||
value: {{ include "taskchampion-sync-server.schema-url" . | quote }}
|
value: {{ include "taskchampion-sync-server.schema-url" . | quote }}
|
||||||
|
{{- if .Values.clientIdSecret }}
|
||||||
|
- name: CLIENT_IDS
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ .Values.clientIdSecret }}
|
||||||
|
key: client-ids
|
||||||
|
{{- end }}
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
@ -57,6 +64,19 @@ spec:
|
|||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
echo 'Schema executed successfully'
|
echo 'Schema executed successfully'
|
||||||
|
if [ -n "$CLIENT_IDS" ]; then
|
||||||
|
echo "Inserting client IDs..."
|
||||||
|
IFS=','
|
||||||
|
for client_id in $CLIENT_IDS; do
|
||||||
|
client_id=$(echo "$client_id" | tr -d ' ')
|
||||||
|
[ -z "$client_id" ] && continue
|
||||||
|
psql "$PGURI" -c "INSERT INTO clients (client_id) VALUES ('$client_id') ON CONFLICT (client_id) DO NOTHING;" || {
|
||||||
|
echo "Failed to insert client $client_id - continuing"
|
||||||
|
}
|
||||||
|
done
|
||||||
|
unset IFS
|
||||||
|
echo "Client ID insertion complete"
|
||||||
|
fi
|
||||||
{{- end }}
|
{{- end }}
|
||||||
containers:
|
containers:
|
||||||
- name: taskchampion-sync-server
|
- name: taskchampion-sync-server
|
||||||
|
|||||||
Reference in New Issue
Block a user