-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- behaves more like libpq (reading password from 4th colon to EOL) - setting PGPASS_NO_DEESCAPE switches of de-escaping fixes: #1
- Loading branch information
1 parent
08fffcd
commit 149db9f
Showing
6 changed files
with
82 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use strict'; | ||
|
||
/* global describe: false */ | ||
/* global it: false */ | ||
/* global after: false */ | ||
/* global before: false */ | ||
|
||
/* jshint -W106 */ | ||
var COV = process.env.npm_lifecycle_event === 'coverage'; | ||
/* jshint +W106 */ | ||
|
||
var assert = require('assert') | ||
, path = require('path') | ||
, pgPass = require( path.join('..', COV ? 'lib-cov' : 'lib' , 'index') ) | ||
; | ||
|
||
|
||
var conn = { | ||
'host' : 'host5' , | ||
'database' : 'database5' , | ||
'user' : 'dummy\\:user' | ||
}; | ||
|
||
describe('#1', function(){ | ||
before(function(){ | ||
process.env.PGPASS_NO_DEESCAPE = true; | ||
process.env.PGPASSFILE = path.join(__dirname, '_pgpass'); | ||
}); | ||
after(function(){ | ||
delete process.env.PGPASS_NO_DEESCAPE; | ||
delete process.env.PGPASSFILE; | ||
}); | ||
|
||
it('should not de-escape NODE_PG_NO_DESCAPE is set', function(done){ | ||
process.env.PGPASSFILE = path.join(__dirname, '_pgpass'); | ||
|
||
pgPass(conn, function(res){ | ||
assert.strictEqual('some:password', res); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters