Skip to content

Commit a060cee

Browse files
authored
Fix clickhouse migrations by adding the secure=true query param (#2160)
1 parent e6fb321 commit a060cee

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docker/scripts/entrypoint.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,19 @@ if [ -n "$CLICKHOUSE_URL" ]; then
1414
# Run ClickHouse migrations
1515
echo "Running ClickHouse migrations..."
1616
export GOOSE_DRIVER=clickhouse
17-
export GOOSE_DBSTRING="$CLICKHOUSE_URL" # Use the full URL provided by the env var
17+
18+
# Ensure secure=true is in the connection string
19+
if echo "$CLICKHOUSE_URL" | grep -q "secure="; then
20+
# secure parameter already exists, use as is
21+
export GOOSE_DBSTRING="$CLICKHOUSE_URL"
22+
elif echo "$CLICKHOUSE_URL" | grep -q "?"; then
23+
# URL has query parameters, append secure=true
24+
export GOOSE_DBSTRING="${CLICKHOUSE_URL}&secure=true"
25+
else
26+
# URL has no query parameters, add secure=true
27+
export GOOSE_DBSTRING="${CLICKHOUSE_URL}?secure=true"
28+
fi
29+
1830
export GOOSE_MIGRATION_DIR=/triggerdotdev/internal-packages/clickhouse/schema
1931
/usr/local/bin/goose up
2032
echo "ClickHouse migrations complete."

0 commit comments

Comments
 (0)