Moves setDBParams into controller

This commit is contained in:
Raul Ochoa
2015-01-20 18:14:10 +01:00
parent 5632b19e16
commit 595dac57a0
2 changed files with 17 additions and 16 deletions
-15
View File
@@ -205,21 +205,6 @@ var CartodbWindshaft = function(serverOptions) {
);
templateMapsController.register(ws);
ws.setDBParams = function(cdbuser, params, callback) {
Step(
function setAuth() {
serverOptions.setDBAuth(cdbuser, params, this);
},
function setConn(err) {
if ( err ) throw err;
serverOptions.setDBConn(cdbuser, params, this);
},
function finish(err) {
callback(err);
}
);
};
var healthCheck = new HealthCheck(cartoData, Windshaft.tilelive);
ws.get('/health', function(req, res) {
+17 -1
View File
@@ -413,7 +413,7 @@ TemplateMapsController.prototype.instantiateTemplate = function(req, res, templa
res: res,
profiler: req.profiler
};
self.app.setDBParams(cdbuser, fakereq.params, this);
self.setDBParams(cdbuser, fakereq.params, this);
},
function setApiKey(err){
if ( req.profiler ) req.profiler.done('setDBParams');
@@ -477,3 +477,19 @@ TemplateMapsController.prototype.finish_instantiation = function(err, response,
this.app.sendResponse(res, [response, 200]);
}
};
TemplateMapsController.prototype.setDBParams = function(cdbuser, params, callback) {
var self = this;
Step(
function setAuth() {
self.serverOptions.setDBAuth(cdbuser, params, this);
},
function setConn(err) {
if ( err ) throw err;
self.serverOptions.setDBConn(cdbuser, params, this);
},
function finish(err) {
callback(err);
}
);
};