From 14d21ec8654ec2b0815e79b703e23b55e8ec6e51 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 18 Dec 2013 19:23:58 +1100 Subject: [PATCH] improve config so you can use it with a socket optionally --- config/database.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/database.yml b/config/database.yml index 2fab24e56cd..64ad0420c80 100644 --- a/config/database.yml +++ b/config/database.yml @@ -42,8 +42,8 @@ production: adapter: postgresql uri: <%= uri = URI.parse(ENV['POSTGRES_URL'] ? ENV['POSTGRES_URL'] : "pg://localhost") %> socket: <%= ENV['POSTGRES_SOCKET'] %> - host: <%= uri.host %> - port: <%= uri.port || (ENV['POSTGRES_SOCKET'] ? nil : 5432) %> + host: <%= ENV['POSTGRES_SOCKET'].present? ? nil : uri.host %> + port: <%= uri.port || (ENV['POSTGRES_SOCKET'].present? ? nil : 5432) %> database: <%= ENV['POSTGRES_DB'] || "discourse" %> username: <%= uri.user %> password: <%= uri.password %>