Skip to content

Commit 99d3b52

Browse files
author
dhh
committed
Use consistent ENV.fetch style
There are no expensive computations here, so no need for a block.
1 parent 5307976 commit 99d3b52

File tree

1 file changed

+3
-3
lines changed
  • railties/lib/rails/generators/rails/app/templates/config

1 file changed

+3
-3
lines changed

railties/lib/rails/generators/rails/app/templates/config/puma.rb.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Any libraries that use a connection pool or another resource pool should
2121
# be configured to provide at least as many connections as the number of
2222
# threads. This includes Active Record's `pool` parameter in `database.yml`.
23-
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 3 }
23+
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
2424
threads threads_count, threads_count
2525

2626
# Specifies the `environment` that Puma will run in.
@@ -35,7 +35,7 @@ when "production"
3535
# It defaults to 1 because it's impossible to reliably detect how many
3636
# CPU cores are available. Make sure to set the `WEB_CONCURRENCY` environment
3737
# variable to match the number of processors.
38-
workers_count = Integer(ENV.fetch("WEB_CONCURRENCY") { 1 })
38+
workers_count = Integer(ENV.fetch("WEB_CONCURRENCY", 1))
3939
workers workers_count if workers_count > 1
4040

4141
preload_app!
@@ -46,7 +46,7 @@ when "development"
4646
end
4747

4848
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
49-
port ENV.fetch("PORT") { 3000 }
49+
port ENV.fetch("PORT", 3000)
5050

5151
# Allow puma to be restarted by `bin/rails restart` command.
5252
plugin :tmp_restart

0 commit comments

Comments
 (0)