Sha256: 2545c97391d51fda7d4625bc70a5af6c3ac176c8f6e7fe0239250f976a435558

Contents?: true

Size: 747 Bytes

Versions: 2

Compression:

Stored size: 747 Bytes

Contents

# frozen_string_literal: true

workers ENV.fetch('WEB_CONCURRENCY') { 0 }
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
threads threads_count, threads_count

environment ENV.fetch('RAILS_ENV') { 'development' }

if %w[production staging].include?(ENV['RAILS_ENV'])
  pidfile 'tmp/pids/puma.pid'
  state_path 'tmp/pids/puma.state'
  daemonize !ENV['RAILS_DAEMONIZE'].nil?

  if ENV['PORT']
    bind "tcp://0.0.0.0:#{ENV['PORT']}"
  else
    bind 'unix://tmp/sockets/puma.sock'
  end
else
  port ENV.fetch('PORT') { 3000 }
end

before_fork do
  ActiveRecord::Base.connection.disconnect!
end

on_worker_boot do
  ActiveSupport.on_load(:active_record) do
    ActiveRecord::Base.establish_connection
  end
end

preload_app!

plugin :tmp_restart

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
eivo-rails-api-0.1.4 lib/generators/eivo/templates/config/puma.rb
eivo-rails-0.1.5 lib/generators/eivo/templates/config/puma.rb