File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ async function main() {
1313 // Step 1: Get SQD credentials
1414 const sqdOutput = execSync ( 'sqd view -o origin -n origin-squid -t prod --json' , { encoding : 'utf8' } )
1515 const sqd = JSON . parse ( sqdOutput )
16- const params = sqd . addons . postgres . connections [ 0 ] . params
16+ const connections = sqd . addons . postgres . connections
17+ const readConn = connections . find ( ( c ) => c . type === 'read' )
18+ const params = ( readConn || connections [ 0 ] ) . params
1719
1820 // Step 2: Connect to Railway database
1921 const client = new Client ( { connectionString : RAILWAY_DATABASE_URL } )
Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ async function main() {
1313 // Step 1: Get SQD credentials
1414 const sqdOutput = execSync ( 'sqd view -o origin -n origin-squid -t prod --json' , { encoding : 'utf8' } )
1515 const sqd = JSON . parse ( sqdOutput )
16- const params = sqd . addons . postgres . connections [ 0 ] . params
16+ const connections = sqd . addons . postgres . connections
17+ const readConn = connections . find ( ( c ) => c . type === 'read' )
18+ const params = ( readConn || connections [ 0 ] ) . params
1719
1820 // Step 2: Fetch current datasource
1921 const res = await fetch ( `${ GRAFANA_URL } /api/datasources/${ DATASOURCE_ID } ` , {
You can’t perform that action at this time.
0 commit comments