Sha256: 6ddebde82c042aa3fee4eb806d62ee9a27f802e909d65ff1831f4ed82fe57722

Contents?: true

Size: 730 Bytes

Versions: 34

Compression:

Stored size: 730 Bytes

Contents

module Workarea
  module Configuration
    module Puma
      extend self

      def load(puma)
        puma.port(port)
        puma.threads(threads, threads)
        puma.environment(environment)

        if workers.present?
          puma.workers(workers)
          puma.preload_app!
        end

        puma.plugin(:tmp_restart)
        puma.set_remote_address(header: 'X-Real-IP') # For hosted environments
      end

      def port
        ENV.fetch('PORT') { 3000 }
      end

      def threads
        ENV.fetch('RAILS_MAX_THREADS') { 5 }
      end

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

      def workers
        ENV.fetch('WEB_CONCURRENCY') { nil }
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
workarea-core-3.4.25 lib/workarea/configuration/puma.rb
workarea-core-3.4.24 lib/workarea/configuration/puma.rb
workarea-core-3.4.23 lib/workarea/configuration/puma.rb
workarea-core-3.4.22 lib/workarea/configuration/puma.rb
workarea-core-3.4.21 lib/workarea/configuration/puma.rb
workarea-core-3.4.20 lib/workarea/configuration/puma.rb
workarea-core-3.4.19 lib/workarea/configuration/puma.rb
workarea-core-3.4.18 lib/workarea/configuration/puma.rb
workarea-core-3.4.17 lib/workarea/configuration/puma.rb
workarea-core-3.4.16 lib/workarea/configuration/puma.rb
workarea-core-3.4.15 lib/workarea/configuration/puma.rb
workarea-core-3.4.14 lib/workarea/configuration/puma.rb
workarea-core-3.4.13 lib/workarea/configuration/puma.rb
workarea-core-3.4.12 lib/workarea/configuration/puma.rb