npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pgpass

v1.0.5

Published

Module for reading .pgpass

Downloads

24,661,134

Readme

pgpass

Build Status

Install

npm install pgpass

Usage

var pgPass = require('pgpass');

var connInfo = {
  'host' : 'pgserver' ,
  'user' : 'the_user_name' ,
};

pgPass(connInfo, function(pass){
  conn_info.password = pass;
  // connect to postgresql server
});

Description

This module tries to read the ~/.pgpass file (or the equivalent for windows systems). If the environment variable PGPASSFILE is set, this file is used instead. If everything goes right, the password from said file is passed to the callback; if the password cannot be read undefined is passed to the callback.

Cases where undefined is returned:

  • the environment variable PGPASSWORD is set
  • the file cannot be read (wrong permissions, no such file, ...)
  • for non windows systems: the file is write-/readable by the group or by other users
  • there is no matching line for the given connection info

There should be no need to use this module directly; it is already included in node-postgres.

Configuration

The module reads the environment variable PGPASS_NO_DEESCAPE to decide if the the read tokens from the password file should be de-escaped or not. Default is to do de-escaping. For further information on this see this commit.

Tests

There are tests in ./test/; including linting and coverage testing. Running npm test runs:

  • jshint
  • mocha tests
  • jscoverage and mocha -R html-cov

You can see the coverage report in coverage.html.

Development, Patches, Bugs, ...

If you find Bugs or have improvements, please feel free to open a issue on GitHub. If you provide a pull request, I'm more than happy to merge them, just make sure to add tests for your changes.

Links

  • https://github.com/hoegaarden/node-pgpass
  • http://www.postgresql.org/docs/current/static/libpq-pgpass.html
  • https://wiki.postgresql.org/wiki/Pgpass
  • https://github.com/postgres/postgres/blob/master/src/interfaces/libpq/fe-connect.c

License

Copyright (c) 2013-2016 Hannes Hörl

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.