Update connection-parameters.js

This commit is contained in:
za-creature 2013-04-11 23:35:21 +03:00
parent 264839d3a9
commit b6ef157e8e

View File

@ -22,7 +22,9 @@ var parse = function(str) {
var result = url.parse(str);
var config = {};
config.host = result.hostname;
config.database = result.pathname ? result.pathname.slice(1) : null;
// not sure if postgres allows symbols in database names
// but we should allow them just in case
config.database = result.pathname ? decodeURI(result.pathname.slice(1)) : null;
var auth = (result.auth || ':').split(':');
config.user = auth[0];
config.password = auth[1];