Ecto postgrex and unix sockets for Phoenix

ecto
phoenix
postgrex
postgresql
socket

#1

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?


#2

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


#3

This code suggests that the directory is all you need:


#4

José Valim answered in https://github.com/elixir-ecto/postgrex/issues/415#issuecomment-428625362
similar to @hackerboos answer.

Thank you for your help @hackerboos and @scribe