Skip to content

Node.js based forum software built for the modern web

Added Postgres SSL Support (#7887)

David Karrick9b4ae4c04afa
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 || {});