mirror of
https://github.com/graphql-hive/console
synced 2026-05-24 09:38:26 +00:00
20 lines
511 B
JavaScript
20 lines
511 B
JavaScript
const {
|
|
POSTGRES_USER = 'postgres',
|
|
POSTGRES_PASSWORD = 'postgres',
|
|
POSTGRES_HOST = 'localhost',
|
|
POSTGRES_PORT = 5432,
|
|
POSTGRES_DB = 'registry',
|
|
POSTGRES_SSL = null,
|
|
POSTGRES_CONNECTION_STRING = null,
|
|
} = process.env;
|
|
|
|
function cn(dbName = POSTGRES_DB) {
|
|
return (
|
|
POSTGRES_CONNECTION_STRING ||
|
|
`postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${dbName}${
|
|
POSTGRES_SSL ? '?sslmode=require' : '?sslmode=disable'
|
|
}`
|
|
);
|
|
}
|
|
|
|
module.exports = cn;
|