pgService
This is a small helper module to read the PostgreSQL Connection Service File.
Install
npm install pgservice # or npm instll hoegaarden/pgservice
Usage
var pgService = ; var conInfo = 'service' : 'my_service_name' 'user' : 'some user' '...' : '...'; ;
Synopsis
;
conInfo
conInfo
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
- on error
- when the desired section is found
- after all connection service files have been read
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.
env
If 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):
PGSERVICEFILE
PGSYSCONFDIR
PGSERVICE
HOME