Added proper config options for PostgreSQL

This commit is contained in:
TheEssem 2020-12-18 15:42:34 -06:00
parent 873b3f59bc
commit 3594c4d353
2 changed files with 13 additions and 6 deletions

View file

@ -8,11 +8,18 @@ NODE_ENV=development
# Put Discord token here # Put Discord token here
TOKEN= TOKEN=
# Put database type here # Put database type here (mongo or postgres)
DB=mongo DB=mongo
# Put MongoDB database URL here
# If you're using MongoDB, put the database URL here
MONGO=mongodb://localhost:27017/esmBot MONGO=mongodb://localhost:27017/esmBot
# If you're using Postgres, fill in the needed info here
PG_USER=esmbot
PG_HOST=localhost
PG_DB=esmbot
PG_PORT=5432
# Put snowflake ID of bot owner here # Put snowflake ID of bot owner here
OWNER= OWNER=

View file

@ -31,10 +31,10 @@ if (process.env.DB === "mongo") {
} else if (process.env.DB === "postgres") { } else if (process.env.DB === "postgres") {
const { Pool } = require("pg"); const { Pool } = require("pg");
const pool = new Pool({ const pool = new Pool({
user: "esmbot", user: process.env.PG_USER,
host: "localhost", host: process.env.PG_HOST,
database: "esmbot", database: process.env.PG_DB,
port: 5432 port: process.env.PG_PORT
}); });
exports.connection = pool; exports.connection = pool;
} }