fix: load dotenv in db.js so DATABASE_URL is available on import
This commit is contained in:
@@ -2,6 +2,9 @@
|
|||||||
// All route files import this module instead of receiving a sqlite3 `db` parameter.
|
// All route files import this module instead of receiving a sqlite3 `db` parameter.
|
||||||
// Configured via DATABASE_URL environment variable.
|
// Configured via DATABASE_URL environment variable.
|
||||||
|
|
||||||
|
// Ensure dotenv is loaded before accessing env vars
|
||||||
|
require('dotenv').config({ path: require('path').join(__dirname, '.env') });
|
||||||
|
|
||||||
const { Pool } = require('pg');
|
const { Pool } = require('pg');
|
||||||
|
|
||||||
if (!process.env.DATABASE_URL) {
|
if (!process.env.DATABASE_URL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user