Skip to content

Commit

Permalink
Fix heroku postgres ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
braemJef committed Feb 14, 2022
1 parent 5b7e31b commit a2e55b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ DB_USERNAME=userdev
DB_PASSWORD=passdev
DB_DATABASE=game
DB_URL=postgres://userdev:passdev@localhost:5432/game
DB_SSL=false
TZ=UTC
PORT=3001
5 changes: 2 additions & 3 deletions src/global/Database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const USERNAME = process.env.DB_USERNAME;
const PASSWORD = process.env.DB_PASSWORD;
const DATABASE = process.env.DB_DATABASE;
const URL = process.env.DB_URL;
const SSL = process.env.DB_SSL;

const DEV = process.env.NODE_ENV === 'development';

Expand All @@ -16,7 +15,7 @@ export default async function initializeDB() {
await createConnection({
type: 'postgres',
url: URL,
ssl: SSL === 'true',
ssl: DEV ? false : { rejectUnauthorized: false },
entities: [DEV ? 'src/**/*.ts' : 'dist/src/**/*.js'],
migrations: [DEV ? 'migration/**/*.ts' : 'dist/migration/**/*.js'],
migrationsRun: true,
Expand All @@ -31,7 +30,7 @@ export default async function initializeDB() {
username: USERNAME,
password: PASSWORD,
database: DATABASE,
ssl: SSL === 'true',
ssl: DEV ? false : { rejectUnauthorized: false },
entities: [DEV ? 'src/**/*.ts' : 'dist/src/**/*.js'],
migrations: [DEV ? 'migration/**/*.ts' : 'dist/migration/**/*.js'],
migrationsRun: true,
Expand Down

0 comments on commit a2e55b4

Please sign in to comment.