Skip to content

Commit

Permalink
Modified default database port config to work for wsl (#895)
Browse files Browse the repository at this point in the history
  • Loading branch information
atbalaji authored Jul 22, 2024
1 parent e6f1ea0 commit a1c6a86
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ default: &default
host: localhost
username: <%= ENV['DATABASE_USERNAME'] %>
password: <%= ENV['DATABASE_PASSWORD'] %>
port: <%= ENV.fetch("DATABASE_PORT", `docker compose port postgres 5432 2> /dev/null`.split(":").last || 5432) %>
port: <%= ENV.fetch("DATABASE_PORT") do
begin
docker_port = `docker compose port postgres 5432 2> /dev/null`.split(":").last
Integer(docker_port.strip)
rescue
5432
end
end %>
# For details on connection pooling, see Rails configuration guide
# https://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
Expand Down

0 comments on commit a1c6a86

Please sign in to comment.