Ecto postgrex and unix sockets for Phoenix

I’m trying to connect to Postgresql using unix sockets, but can’t find documentation or examples on how to do it.
postgrex already has support for unix sockets.

It seems that I could place some configuration such as
config :postgrex, socket_dir: "/var/run/postgres (maybe it’s wrong) in config/config.exs, but would need (I think) to change Ecto as well.

How to do this?

I think you do it by passing in the path to the directory as the host name???

This code suggests that the directory is all you need:

1 Like

José Valim answered in
similar to @hackerboos answer.

Thank you for your help @hackerboos and @scribe


I set this, but I have this error in github ci

** (DBConnection.ConnectionError) tcp connect (/var/run/postgresql/.s.PGSQL.5432): no such file or directory - :enoent

Do you have any suggestion?

A general forum etiquette suggestion: don’t go to 3+ year-old threads and re-ask a question that has a current thread. And if you do, at least link the current discussion