Fix database connection settings on template instanciation

Closes #174
Enhances testsuite to ensure test.js settings are read
This commit is contained in:
Sandro Santilli 2014-02-28 15:55:29 +01:00
parent cf0c33a85d
commit ddd2628c19
3 changed files with 18 additions and 0 deletions

View File

@ -9,6 +9,10 @@ Enhancements:
- Change some http status responses to be more appropriate to the case
- Forbid using map signatures of foreign users (#172)
Bug fixes:
- Fix database connection settings on template instanciation (#174)
1.8.3 -- 2014-02-27
-------------------

View File

@ -503,6 +503,14 @@ module.exports = function(){
// @param callback function(err)
//
me.setDBConn = function(dbowner, params, callback) {
// Add default database connection parameters
// if none given
_.defaults(params, {
dbuser: global.environment.postgres.user,
dbpassword: global.environment.postgres.password,
dbhost: global.environment.postgres.host,
dbport: global.environment.postgres.port
});
Step(
function getDatabaseHost(){
cartoData.getUserDBHost(dbowner, this);

View File

@ -10,6 +10,12 @@ var strftime = require('strftime');
var SQLAPIEmu = require(__dirname + '/../support/SQLAPIEmu.js');
var redis_stats_db = 5;
// Pollute the PG environment to make sure
// configuration settings are always enforced
// See https://github.com/CartoDB/Windshaft-cartodb/issues/174
process.env['PGPORT'] = '666';
process.env['PGHOST'] = 'fake';
require(__dirname + '/../support/test_helper');
var windshaft_fixtures = __dirname + '/../../node_modules/windshaft/test/fixtures';