diff --git a/server/.env.sample b/server/.env.sample index aac41a0..b50f20c 100644 --- a/server/.env.sample +++ b/server/.env.sample @@ -14,6 +14,9 @@ SECRET_KEY=notsecretkey # have to use environment variables in order to pass the desired values, e.g. # PGSSLMODE= +# Configure knex to accept SSL Certificates +# REJECT_UNAUTHORIZED_SSL_CERTIFICATE=false + ## Do not edit this TZ=UTC diff --git a/server/db/knexfile.js b/server/db/knexfile.js index 7ba13d9..95f4e73 100755 --- a/server/db/knexfile.js +++ b/server/db/knexfile.js @@ -6,13 +6,21 @@ dotenv.config({ path: path.resolve(__dirname, '../.env'), }); +function buildSSLConfig() { + if (process.env.REJECT_UNAUTHORIZED_SSL_CERTIFICATE) { + return { + rejectUnauthorized: false, + }; + } + + return false; +} + module.exports = { client: 'pg', connection: { connectionString: process.env.DATABASE_URL, - ssl: { - rejectUnauthorized: false, - }, + ssl: buildSSLConfig(), }, migrations: { tableName: 'migration',