From d7d9de3bbea8b35602096665cd8acce7ccd24d31 Mon Sep 17 00:00:00 2001 From: Jansen Fuller Date: Sun, 3 May 2026 13:14:10 -0600 Subject: [PATCH] Auto add UUIDs when starting postgres --- .../templates/deployment.yaml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/helm/taskchampion-sync-server/templates/deployment.yaml b/helm/taskchampion-sync-server/templates/deployment.yaml index 2f4d1b2..ccc3c8f 100644 --- a/helm/taskchampion-sync-server/templates/deployment.yaml +++ b/helm/taskchampion-sync-server/templates/deployment.yaml @@ -38,6 +38,13 @@ spec: key: connection - name: SCHEMA_URL value: {{ include "taskchampion-sync-server.schema-url" . | quote }} + {{- if .Values.clientIdSecret }} + - name: CLIENT_IDS + valueFrom: + secretKeyRef: + name: {{ .Values.clientIdSecret }} + key: client-ids + {{- end }} command: - sh - -c @@ -57,6 +64,19 @@ spec: exit 0 } 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 }} containers: - name: taskchampion-sync-server