Skip to content

Commit

Permalink
force SSL
Browse files Browse the repository at this point in the history
  • Loading branch information
keithwhor committed May 27, 2016
1 parent 037dcb8 commit 1e28aa7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/required/db/adapters/postgres.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = (function() {
return '';
}

return 'postgres://' + user + ':' + password + '@' + host + ':' + port + '/' + database;
return 'postgres://' + user + ':' + password + '@' + host + ':' + port + '/' + database + '?ssl=true';

}

Expand Down
7 changes: 6 additions & 1 deletion core/required/db/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ module.exports = (() => {
connectionString = this.adapter.generateConnectionString(cfg.host, cfg.port, cfg.database, cfg.user, cfg.password);
}

// force SSL -- hacky for now.
if (connectionString.indexOf('?ssl=true') === -1) {
connectionString += '?ssl=true';
}

try {
connection = anyDB.createPool(connectionString, {min: 2, max: 2});
} catch (e) {
Expand Down Expand Up @@ -153,7 +158,7 @@ module.exports = (() => {

db.info('Transaction error');
err.message && db.error(err.message);

transactionError = err;
callback(transactionError, transactionResults);

Expand Down

0 comments on commit 1e28aa7

Please sign in to comment.