package
Module for reading .pg_service.conf
npm install pgserviceGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 3 packages.
788.8 kB
Includes dependencies.
This is a small helper module to read the PostgreSQL Connection Service File.
npm install pgservice
# or
npm instll hoegaarden/pgservicevar pgService = require('pgservice');
var conInfo = {
'service' : 'my_service_name'
, 'user' : 'some user'
, '...' : '...'
};
pgService(conInfo, function(err, conInfo){
if (err) {
// bail out or whatever
}
/*
* conInfo has now additional fields read from
* the appropriate Connection Service Files
*/
console.log(conInfo);
});pgService(conInfo, cb, env);conInfoconInfo should be a hash with the desired connection settings. If this hash has a value for the key service the module tries to read the corresponding section from a connection service file.
cb(err, conInfo)The callback is called
If an appropriate section could be found all options from this section are added to conInfo, however: any setting which has already been set in conInfo doesn't get overwritten.
envIf you want or need to you can pass in a hash of environment variables which are used for selecting the approprtiate file, the section name, ...
If no env gets passed process.env is uesd (you most likely don't want to pass in anything).
Following variables are potentialy read from the env (see also: PostgreSQL Documentation):
PGSERVICEFILEPGSYSCONFDIRPGSERVICEHOME