Detect 127.0.0.1 in js as local connection

This commit is contained in:
Dan Sosedoff
2014-11-21 20:04:02 -06:00
parent 09aa95fe2e
commit 22bcfafa76
2 changed files with 252 additions and 248 deletions

View File

@@ -343,7 +343,9 @@ function getConnectionString() {
url = "postgres://" + user + ":" + pass + "@" + host + ":" + port + "/" + db + "?sslmode=" + ssl;
}
else {
if (url.indexOf("localhost") != -1 && url.indexOf("sslmode") == -1) {
var local = url.indexOf("localhost") != -1 || url.indexOf("127.0.0.1") != -1;
if (local && url.indexOf("sslmode") == -1) {
url += "?sslmode=" + ssl;
}
}