add support for reading database url from password

This commit is contained in:
sid palas
2023-02-03 16:29:48 -05:00
parent 732ee2f648
commit f709ee9abd
2 changed files with 18 additions and 2 deletions

View File

@ -1,7 +1,13 @@
const fs = require('fs');
const { Pool } = require('pg');
databaseUrl =
process.env.DATABASE_URL ||
fs.readFileSync(process.env.DATABASE_URL_FILE, 'utf8');
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
connectionString: databaseUrl,
});
// the pool will emit an error on behalf of any idle clients