From 9b4ae4c04afaa770c2c04e0169f918e94bec66cf Mon Sep 17 00:00:00 2001 From: David Karrick <48275422+Th3Whit3Wolf@users.noreply.github.com> Date: Sat, 7 Sep 2019 18:27:51 +0100 Subject: [PATCH] Added Postgres SSL Support (#7887) * [Added] Postgres SSL Support * [Added]Postgres SSL Support * [Added] Postgres SSL Support --- install/databases.js | 1 + src/database/postgres.js | 5 +++++ src/database/postgres/connection.js | 1 + 3 files changed, 7 insertions(+) diff --git a/install/databases.js b/install/databases.js index 45de648cb0..edabcdf9ac 100644 --- a/install/databases.js +++ b/install/databases.js @@ -83,6 +83,7 @@ function saveDatabaseConfig(config, databaseConfig, callback) { username: databaseConfig['postgres:username'], password: databaseConfig['postgres:password'], database: databaseConfig['postgres:database'], + ssl: databaseConfig['postgres:ssl'], }; } else { return callback(new Error('unknown database : ' + config.database)); diff --git a/src/database/postgres.js b/src/database/postgres.js index 17b1e02714..6872b75902 100644 --- a/src/database/postgres.js +++ b/src/database/postgres.js @@ -38,6 +38,11 @@ postgresModule.questions = [ description: 'PostgreSQL database name', default: nconf.get('postgres:database') || 'nodebb', }, + { + name: 'postgres:ssl', + description: 'Enable SSL for PostgreSQL database access', + default: nconf.get('postgres:ssl') || false, + }, ]; postgresModule.init = function (callback) { diff --git a/src/database/postgres/connection.js b/src/database/postgres/connection.js index 028d631f28..526fc44bab 100644 --- a/src/database/postgres/connection.js +++ b/src/database/postgres/connection.js @@ -27,6 +27,7 @@ connection.getConnectionOptions = function (postgres) { user: postgres.username, password: postgres.password, database: postgres.database, + ssl: postgres.ssl, }; return _.merge(connOptions, postgres.options || {});