2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/govuk_app_config/govuk_puma.rb', line 2
def self.configure_rails(config)
config.port ENV.fetch("PORT", 3000)
config.environment ENV.fetch("RAILS_ENV", "development")
if ENV["GOVUK_APP_LOGROOT"]
config.stdout_redirect "#{ENV['GOVUK_APP_LOGROOT']}/app.out.log" + "#{ENV['GOVUK_APP_LOGROOT']}/app.err.log"
end
timeout = if ENV.fetch("RAILS_ENV", "development") == "development"
3600
else
Integer(ENV.fetch("PUMA_TIMEOUT", 15))
end
config.worker_timeout timeout
max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 5)
min_threads_count = ENV.fetch("RAILS_MIN_THREADS", max_threads_count)
config.threads min_threads_count, max_threads_count
config.workers ENV.fetch("WEB_CONCURRENCY", 2)
config.preload_app!
config.before_fork do |_server|
next unless ENV["GOVUK_APP_ROOT"]
ENV["BUNDLE_GEMFILE"] = "#{ENV['GOVUK_APP_ROOT']}/Gemfile"
end
config.plugin :tmp_restart
end
|