Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Construction of db connection string fails on UNIX sockets. #315

Closed
pmack opened this issue Aug 22, 2018 · 1 comment
Closed

Construction of db connection string fails on UNIX sockets. #315

pmack opened this issue Aug 22, 2018 · 1 comment

Comments

@pmack
Copy link

pmack commented Aug 22, 2018

The way that the DB connection URI is put together in the readJson function
in https://github.com/salsita/node-pg-migrate/blob/master/bin/node-pg-migrate#L185, causes connections to fail when specifying a socket rather than TCP connection via a configuration file.

For example, a config of:

db:
  host: "/tmp"
  port: 5555
  user: someuser
  password: somepassword
  database: somedatabase

Yields the connection URI: postgres://someuser:somepassword@/tmp:5555/somedatabase

This blows up with:
error: no pg_hba.conf entry for host "127.0.0.1", user "someuser", database "tmp:5555/somedatabase", SSL off.

Since the format of the config object matches what node-postgres expects, couldn't that just be passed straight on to its new Client() function instead? Patching it to just set DATABASE_URL = json; seems to work in my, albeit very limited testing.

@dolezel
Copy link
Contributor

dolezel commented Aug 23, 2018

Thanks! I didn't realize that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants