chore: Add env variable to toggle postgresql ssl flag

This commit is contained in:
Faruk AYDIN
2021-11-23 14:32:52 +01:00
committed by Ali BARIN
parent cf1fa9039b
commit a5811d44ac
3 changed files with 6 additions and 3 deletions

View File

@@ -7,4 +7,5 @@ POSTGRES_DATABASE=automatisch_development
POSTGRES_PORT=5432
POSTGRES_HOST=localhost
POSTGRES_USERNAME=automatish_development_user
POSTGRESS_PASSWORD=
POSTGRES_PASSWORD=
POSTGRES_ENABLE_SSL=false

View File

@@ -8,7 +8,7 @@ const knexConfig = {
user: appConfig.postgresUsername,
password: appConfig.postgresPassword,
database: appConfig.postgresDatabase,
ssl: true,
ssl: appConfig.postgresEnableSsl
},
migrations: {
directory: __dirname + '/src/db/migrations',

View File

@@ -12,6 +12,7 @@ type AppConfig = {
postgresHost: string,
postgresUsername: string,
postgresPassword: string,
postgresEnableSsl: boolean,
baseUrl?: string
}
@@ -25,7 +26,8 @@ const appConfig: AppConfig = {
postgresPort: parseInt(process.env.POSTGRES_PORT) || 5432,
postgresHost: process.env.POSTGRES_HOST || 'localhost',
postgresUsername: process.env.POSTGRES_USERNAME || 'automatish_development_user',
postgresPassword: process.env.POSTGRESS_PASSWORD,
postgresPassword: process.env.POSTGRES_PASSWORD,
postgresEnableSsl: process.env.POSTGRES_ENABLE_SSL === 'true' ? true : false,
}
const baseUrl = `${appConfig.protocol}://${appConfig.host}:${appConfig.port}`;