Skip to content

Commit

Permalink
Add ssl for DOAP
Browse files Browse the repository at this point in the history
When running migrations on DOAP I got the following error:

Error during migration run:
error: no pg_hba.conf entry for host "134.209.211.49", user "db",
database "db", SSL off.

This should fix it.

See typeorm/typeorm#278
  • Loading branch information
dansteren committed Dec 19, 2020
1 parent 448d22c commit 1316403
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ormconfig.js
@@ -1,16 +1,22 @@
let folder, extension, ssl

switch (process.env.NODE_ENV) {
case 'production':
case 'staging':
folder = 'dist'
extension = 'js'
ssl = true
break
case 'development':
default:
folder = 'src'
extension = 'ts'
ssl = false
break
}

console.log(`Typeorm configured for ${process.env.NODE_ENV}`)

module.exports = {
type: 'postgres',
host: process.env.DB_HOST,
Expand All @@ -20,6 +26,9 @@ module.exports = {
database: process.env.DB_NAME,
synchronize: false,
logging: false,
extra: {
ssl
},
entities: [`${folder}/entity/**/*.${extension}`],
migrations: [`${folder}/migration/**/*.${extension}`],
subscribers: [`${folder}/subscriber/**/*.${extension}`],
Expand Down

0 comments on commit 1316403

Please sign in to comment.