improve config so you can use it with a socket optionally

This commit is contained in:
Sam 2013-12-18 19:23:58 +11:00
parent 786f488186
commit 14d21ec865
1 changed files with 2 additions and 2 deletions

View File

@ -42,8 +42,8 @@ production:
adapter: postgresql adapter: postgresql
uri: <%= uri = URI.parse(ENV['POSTGRES_URL'] ? ENV['POSTGRES_URL'] : "pg://localhost") %> uri: <%= uri = URI.parse(ENV['POSTGRES_URL'] ? ENV['POSTGRES_URL'] : "pg://localhost") %>
socket: <%= ENV['POSTGRES_SOCKET'] %> socket: <%= ENV['POSTGRES_SOCKET'] %>
host: <%= uri.host %> host: <%= ENV['POSTGRES_SOCKET'].present? ? nil : uri.host %>
port: <%= uri.port || (ENV['POSTGRES_SOCKET'] ? nil : 5432) %> port: <%= uri.port || (ENV['POSTGRES_SOCKET'].present? ? nil : 5432) %>
database: <%= ENV['POSTGRES_DB'] || "discourse" %> database: <%= ENV['POSTGRES_DB'] || "discourse" %>
username: <%= uri.user %> username: <%= uri.user %>
password: <%= uri.password %> password: <%= uri.password %>