@@ -15,15 +15,15 @@ function initializeRunsReplicationInstance() {
1515 const { DATABASE_URL } = process . env ;
1616 invariant ( typeof DATABASE_URL === "string" , "DATABASE_URL env var not set" ) ;
1717
18- if ( ! env . RUN_REPLICATION_CLICKHOUSE_URL ) {
19- console . log ( "🗃️ Runs replication service not enabled " ) ;
18+ if ( env . RUN_REPLICATION_ENABLED !== "1" ) {
19+ console . log ( "🗃️ Runs replication service disabled (RUN_REPLICATION_ENABLED=0) " ) ;
2020 return ;
2121 }
2222
23- console . log ( "🗃️ Runs replication service enabled " ) ;
23+ console . log ( "🗃️ Runs replication service starting " ) ;
2424
2525 const clickhouse = new ClickHouse ( {
26- url : env . RUN_REPLICATION_CLICKHOUSE_URL ,
26+ url : env . CLICKHOUSE_URL ,
2727 name : "runs-replication" ,
2828 keepAlive : {
2929 enabled : env . RUN_REPLICATION_KEEP_ALIVE_ENABLED === "1" ,
@@ -68,21 +68,19 @@ function initializeRunsReplicationInstance() {
6868 insertStrategy : env . RUN_REPLICATION_INSERT_STRATEGY ,
6969 } ) ;
7070
71- if ( env . RUN_REPLICATION_ENABLED === "1" ) {
72- service
73- . start ( )
74- . then ( ( ) => {
75- console . log ( "🗃️ Runs replication service started" ) ;
76- } )
77- . catch ( ( error ) => {
78- console . error ( "🗃️ Runs replication service failed to start" , {
79- error,
80- } ) ;
71+ service
72+ . start ( )
73+ . then ( ( ) => {
74+ console . log ( "🗃️ Runs replication service started" ) ;
75+ } )
76+ . catch ( ( error ) => {
77+ console . error ( "🗃️ Runs replication service failed to start" , {
78+ error,
8179 } ) ;
80+ } ) ;
8281
83- signalsEmitter . on ( "SIGTERM" , service . shutdown . bind ( service ) ) ;
84- signalsEmitter . on ( "SIGINT" , service . shutdown . bind ( service ) ) ;
85- }
82+ signalsEmitter . on ( "SIGTERM" , service . shutdown . bind ( service ) ) ;
83+ signalsEmitter . on ( "SIGINT" , service . shutdown . bind ( service ) ) ;
8684
8785 return service ;
8886}
0 commit comments