Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails PostgreSQL socket path

Suppose that I have a Postgres cluster running, with its Unix domain socket located under /some/custom/path

How do I set up my database.yml so that the Rails app can connect to the cluster?

like image 637
MrMobster Avatar asked Nov 20 '14 09:11

MrMobster


1 Answers

From the postgres docs:

host: Name of host to connect to. If this begins with a slash, it specifies Unix-domain communication rather than TCP/IP communication; the value is the name of the directory in which the socket file is stored.

The ActiveRecord adapter just passes through the host parameter so it's as simple as just putting this line in your database.yml:

host: /path/to/socket/file
like image 150
Dave Slutzkin Avatar answered Sep 21 '22 18:09

Dave Slutzkin