Moves setDBParams to serverOptions so it can be reused
This commit is contained in:
parent
8503a5c7c9
commit
e7bd5dd644
@ -302,7 +302,7 @@ TemplateMapsController.prototype.instantiateTemplate = function(req, res, templa
|
|||||||
res: res,
|
res: res,
|
||||||
profiler: req.profiler
|
profiler: req.profiler
|
||||||
};
|
};
|
||||||
self.setDBParams(cdbuser, fakereq.params, this);
|
self.serverOptions.setDBParams(cdbuser, fakereq.params, this);
|
||||||
},
|
},
|
||||||
function setApiKey(err){
|
function setApiKey(err){
|
||||||
if ( req.profiler ) req.profiler.done('setDBParams');
|
if ( req.profiler ) req.profiler.done('setDBParams');
|
||||||
@ -343,22 +343,6 @@ TemplateMapsController.prototype.finish_instantiation = function(err, response,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TemplateMapsController.prototype.setDBParams = function(cdbuser, params, callback) {
|
|
||||||
var self = this;
|
|
||||||
step(
|
|
||||||
function setAuth() {
|
|
||||||
self.pgConnection.setDBAuth(cdbuser, params, this);
|
|
||||||
},
|
|
||||||
function setConn(err) {
|
|
||||||
if ( err ) throw err;
|
|
||||||
self.pgConnection.setDBConn(cdbuser, params, this);
|
|
||||||
},
|
|
||||||
function finish(err) {
|
|
||||||
callback(err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
function finishFn(app, res, description, okResponse) {
|
function finishFn(app, res, description, okResponse) {
|
||||||
return function finish(err, response){
|
return function finish(err, response){
|
||||||
var statusCode = 200;
|
var statusCode = 200;
|
||||||
|
@ -509,6 +509,21 @@ module.exports = function(redisPool) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
me.setDBParams = function(cdbuser, params, callback) {
|
||||||
|
step(
|
||||||
|
function setAuth() {
|
||||||
|
pgConnection.setDBAuth(cdbuser, params, this);
|
||||||
|
},
|
||||||
|
function setConn(err) {
|
||||||
|
if ( err ) throw err;
|
||||||
|
pgConnection.setDBConn(cdbuser, params, this);
|
||||||
|
},
|
||||||
|
function finish(err) {
|
||||||
|
callback(err);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
// jshint maxcomplexity:10
|
// jshint maxcomplexity:10
|
||||||
/**
|
/**
|
||||||
* Whitelist input and get database name & default geometry type from
|
* Whitelist input and get database name & default geometry type from
|
||||||
|
Loading…
Reference in New Issue
Block a user