Sets the sqlapi domain. Fixes #82

This commit is contained in:
Javier Arce 2013-09-12 15:36:50 +02:00 committed by Sandro Santilli
parent 0c4bcca7c9
commit d4d5272bf2

View File

@ -9,7 +9,9 @@ var _ = require('underscore')
;
// This is for backward compatibility with 1.3.3
if ( ! global.environment.sqlapi.domain ) global.environment.sqlapi.host;
if ( ! global.environment.sqlapi.domain ) {
global.environment.sqlapi.domain = global.environment.sqlapi.host;
}
module.exports = function(){
@ -84,7 +86,7 @@ module.exports = function(){
callback(new Error(msg));
console.log('unexpected response status (' + res.statusCode + ') for sql query: ' + sql + ': ' + msg);
return;
}
}
callback(null, body.rows);
});
};
@ -162,7 +164,7 @@ module.exports = function(){
if ( me.channelCache.hasOwnProperty(cacheKey) ) {
callback(null, me.channelCache[cacheKey]);
return;
}
}
else if ( req.params.token ) {
// cached cache channel for token-based access should be constructed
// at cache creation time
@ -233,7 +235,7 @@ module.exports = function(){
me.generateCacheChannel(req, function(err, channel){
if ( ! err ) {
res.header('X-Cache-Channel', channel);
cb(null, channel);
cb(null, channel);
} else {
console.log('ERROR generating cache channel: ' + ( err.message ? err.message : err ));
// TODO: evaluate if we should bubble up the error instead
@ -322,7 +324,7 @@ module.exports = function(){
delete req.query.lzma
_.extend(req.query, JSON.parse(result))
me.req2params(req, callback);
} catch (err) {
} catch (err) {
callback(new Error('Error parsing lzma as JSON: ' + err));
}
},