Fix multiple DB login issues
This commit is contained in:
parent
3c586caba4
commit
aa09c079f6
1
NEWS.md
1
NEWS.md
@ -15,6 +15,7 @@ Announcements:
|
||||
- When `cache buster` in request path is `0` set header `Last-Modified` to now, it avoids stalled content in 3rd party cache providers when they add `If-Modified-Since` header into the request.
|
||||
- Adding a logger to MapStore (#1134)
|
||||
- Qualify calls to cartodb extension so having it in the search_path isn't necessary.
|
||||
- Fix multiple DB login issues.
|
||||
|
||||
## 7.2.0
|
||||
Released 2019-09-30
|
||||
|
@ -3,6 +3,7 @@
|
||||
var PSQL = require('cartodb-psql');
|
||||
var _ = require('underscore');
|
||||
const debug = require('debug')('cachechan');
|
||||
const dbParamsFromReqParams = require('../utils/database-params');
|
||||
|
||||
function PgConnection(metadataBackend) {
|
||||
this.metadataBackend = metadataBackend;
|
||||
@ -124,14 +125,7 @@ PgConnection.prototype.getConnection = function(username, callback) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
return callback(err, new PSQL({
|
||||
user: databaseParams.dbuser,
|
||||
pass: databaseParams.dbpass,
|
||||
host: databaseParams.dbhost,
|
||||
port: databaseParams.dbport,
|
||||
dbname: databaseParams.dbname
|
||||
}));
|
||||
|
||||
return callback(err, new PSQL(dbParamsFromReqParams(databaseParams)));
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var PSQL = require('cartodb-psql');
|
||||
const dbParamsFromReqParams = require('../utils/database-params');
|
||||
|
||||
function PgQueryRunner(pgConnection) {
|
||||
this.pgConnection = pgConnection;
|
||||
@ -22,13 +23,7 @@ PgQueryRunner.prototype.run = function(username, query, callback) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
const psql = new PSQL({
|
||||
user: databaseParams.dbuser,
|
||||
pass: databaseParams.dbpass,
|
||||
host: databaseParams.dbhost,
|
||||
port: databaseParams.dbport,
|
||||
dbname: databaseParams.dbname
|
||||
});
|
||||
const psql = new PSQL(dbParamsFromReqParams(databaseParams));
|
||||
|
||||
psql.query(query, function (err, resultSet) {
|
||||
resultSet = resultSet || {};
|
||||
|
@ -92,7 +92,12 @@ MapConfigNamedLayersAdapter.prototype.getMapConfig = function (user, requestMapC
|
||||
layers.push(layer);
|
||||
if (layersResult.datasource) {
|
||||
datasourceBuilder.withLayerDatasource(currentLayerIndex, {
|
||||
user: dbAuth.dbuser
|
||||
user: dbAuth.dbuser,
|
||||
// Used internally (PSQL)
|
||||
pass: dbAuth.dbpassword,
|
||||
dbpassword: dbAuth.dbpassword,
|
||||
// Used by Mapnik
|
||||
password: dbAuth.dbpassword
|
||||
});
|
||||
}
|
||||
currentLayerIndex++;
|
||||
|
@ -242,7 +242,7 @@ module.exports = class NamedMapMapConfigProvider extends BaseMapConfigProvider {
|
||||
}
|
||||
|
||||
dbParams.dbuser = databaseParams.dbuser;
|
||||
dbParams.dbpass = databaseParams.dbpass;
|
||||
dbParams.dbpassword = databaseParams.dbpassword;
|
||||
dbParams.dbhost = databaseParams.dbhost;
|
||||
dbParams.dbport = databaseParams.dbport;
|
||||
dbParams.dbname = databaseParams.dbname;
|
||||
|
Loading…
Reference in New Issue
Block a user