Skip to content

Commit 6a6b48c

Browse files
committed
use read permissions in update scripts
1 parent afd5d08 commit 6a6b48c

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

scripts/update-fdw.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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 })

scripts/update-grafana-ds.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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}`, {

0 commit comments

Comments
 (0)