You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
414 B
TypeScript
24 lines
414 B
TypeScript
import { Pool } from 'pg';
|
|
import dotenv from 'dotenv';
|
|
|
|
dotenv.config();
|
|
|
|
const {
|
|
ENV,
|
|
POSTGRES_HOST,
|
|
POSTGRES_DB,
|
|
POSTGRES_USER,
|
|
POSTGRES_PASSWORD
|
|
} = process.env;
|
|
|
|
let client = new Pool();
|
|
if (ENV === 'dev') {
|
|
client = new Pool({
|
|
host: POSTGRES_HOST,
|
|
database: POSTGRES_DB,
|
|
user: POSTGRES_USER,
|
|
password: POSTGRES_PASSWORD
|
|
});
|
|
}
|
|
|
|
export default client |