File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,8 +57,13 @@ export async function action({ request }: ActionFunctionArgs) {
5757}
5858
5959function createRunReplicationService ( params : CreateRunReplicationServiceParams ) {
60+ const url = new URL ( env . RUN_REPLICATION_CLICKHOUSE_URL ) ;
61+
62+ // Remove secure param
63+ url . searchParams . delete ( "secure" ) ;
64+
6065 const clickhouse = new ClickHouse ( {
61- url : env . RUN_REPLICATION_CLICKHOUSE_URL ,
66+ url : url . toString ( ) ,
6267 name : params . name ,
6368 keepAlive : {
6469 enabled : params . keepAliveEnabled ,
Original file line number Diff line number Diff line change @@ -22,8 +22,13 @@ function initializeRunsReplicationInstance() {
2222
2323 console . log ( "🗃️ Runs replication service enabled" ) ;
2424
25+ const url = new URL ( env . RUN_REPLICATION_CLICKHOUSE_URL ) ;
26+
27+ // Remove secure param
28+ url . searchParams . delete ( "secure" ) ;
29+
2530 const clickhouse = new ClickHouse ( {
26- url : env . RUN_REPLICATION_CLICKHOUSE_URL ,
31+ url : url . toString ( ) ,
2732 name : "runs-replication" ,
2833 keepAlive : {
2934 enabled : env . RUN_REPLICATION_KEEP_ALIVE_ENABLED === "1" ,
Original file line number Diff line number Diff line change @@ -18,17 +18,12 @@ if [ -n "$CLICKHOUSE_URL" ] && [ "$SKIP_CLICKHOUSE_MIGRATIONS" != "1" ]; then
1818 echo " Running ClickHouse migrations..."
1919 export GOOSE_DRIVER=clickhouse
2020
21- # Ensure secure=true is in the connection string
22- if echo " $CLICKHOUSE_URL " | grep -q " secure=" ; then
23- # secure parameter already exists, use as is
24- export GOOSE_DBSTRING=" $CLICKHOUSE_URL "
25- elif echo " $CLICKHOUSE_URL " | grep -q " ?" ; then
26- # URL has query parameters, append secure=true
27- export GOOSE_DBSTRING=" ${CLICKHOUSE_URL} &secure=true"
28- else
29- # URL has no query parameters, add secure=true
30- export GOOSE_DBSTRING=" ${CLICKHOUSE_URL} ?secure=true"
31- fi
21+ # Strip secure parameter from URL before passing to goose
22+ # The scheme (http:// vs https://) already encodes TLS choice, so secure param is redundant
23+ export GOOSE_DBSTRING=" $( echo " $CLICKHOUSE_URL " | sed ' s/[?&]secure=[^&]*//g' ) "
24+
25+ # Remove trailing ? or & if present after stripping secure param
26+ export GOOSE_DBSTRING=" $( echo " $GOOSE_DBSTRING " | sed ' s/[?&]$//' ) "
3227
3328 export GOOSE_MIGRATION_DIR=/triggerdotdev/internal-packages/clickhouse/schema
3429 /usr/local/bin/goose up
You can’t perform that action at this time.
0 commit comments