Actually get DB endpoint from env vars
This commit is contained in:
parent
6330c02389
commit
491d8918df
1 changed files with 13 additions and 10 deletions
23
db.js
23
db.js
|
@ -1,12 +1,15 @@
|
|||
import postgres from "postgres";
|
||||
|
||||
const sql = postgres(
|
||||
process.env.DB_CONNECTION_STRING || process.env.NODE_ENV == "production"
|
||||
? "postgres://h_countify-prod?host=%2Fvar%2Flib%2Fpostgresql"
|
||||
: {
|
||||
host: "/var/run/postgresql",
|
||||
database: "h_countify-dev",
|
||||
debug: true,
|
||||
},
|
||||
);
|
||||
var db_endpoint;
|
||||
db_endpoint = process.env?.DB_CONNECTION_STRING;
|
||||
if (!db_endpoint) {
|
||||
db_endpoint =
|
||||
process.env.NODE_ENV == "production"
|
||||
? "postgres://h_countify-prod?host=%2Fvar%2Flib%2Fpostgresql"
|
||||
: {
|
||||
host: "/var/run/postgresql",
|
||||
database: "h_countify-dev",
|
||||
debug: true,
|
||||
};
|
||||
}
|
||||
const sql = postgres(db_endpoint);
|
||||
export default sql;
|
||||
|
|
Loading…
Reference in a new issue