Fix database ssl connection
This commit is contained in:
parent
b9244002fc
commit
6bc672da81
1 changed files with 11 additions and 2 deletions
|
@ -51,18 +51,27 @@ const dbname = CONFIG.DATABASE.DBNAME
|
||||||
const username = CONFIG.DATABASE.USERNAME
|
const username = CONFIG.DATABASE.USERNAME
|
||||||
const password = CONFIG.DATABASE.PASSWORD
|
const password = CONFIG.DATABASE.PASSWORD
|
||||||
const host = CONFIG.DATABASE.HOSTNAME
|
const host = CONFIG.DATABASE.HOSTNAME
|
||||||
const ssl = CONFIG.DATABASE.SSL
|
|
||||||
const port = CONFIG.DATABASE.PORT
|
const port = CONFIG.DATABASE.PORT
|
||||||
const poolMax = CONFIG.DATABASE.POOL.MAX
|
const poolMax = CONFIG.DATABASE.POOL.MAX
|
||||||
|
|
||||||
|
let dialectOptions: any = {}
|
||||||
|
|
||||||
|
if (CONFIG.DATABASE.SSL) {
|
||||||
|
dialectOptions = {
|
||||||
|
ssl: {
|
||||||
|
rejectUnauthorized: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const sequelizeTypescript = new SequelizeTypescript({
|
const sequelizeTypescript = new SequelizeTypescript({
|
||||||
database: dbname,
|
database: dbname,
|
||||||
dialect: 'postgres',
|
dialect: 'postgres',
|
||||||
|
dialectOptions,
|
||||||
host,
|
host,
|
||||||
port,
|
port,
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
ssl,
|
|
||||||
pool: {
|
pool: {
|
||||||
max: poolMax
|
max: poolMax
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue