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.45 lib/workarea/configuration/puma.rb
workarea-core-3.4.44 lib/workarea/configuration/puma.rb
workarea-core-3.4.43 lib/workarea/configuration/puma.rb
workarea-core-3.4.42 lib/workarea/configuration/puma.rb
workarea-core-3.4.41 lib/workarea/configuration/puma.rb
workarea-core-3.4.40 lib/workarea/configuration/puma.rb
workarea-core-3.4.39 lib/workarea/configuration/puma.rb
workarea-core-3.4.38 lib/workarea/configuration/puma.rb
workarea-core-3.4.37 lib/workarea/configuration/puma.rb
workarea-core-3.4.36 lib/workarea/configuration/puma.rb
workarea-core-3.4.35 lib/workarea/configuration/puma.rb
workarea-core-3.4.34 lib/workarea/configuration/puma.rb
workarea-core-3.4.33 lib/workarea/configuration/puma.rb
workarea-core-3.4.32 lib/workarea/configuration/puma.rb
workarea-core-3.4.31 lib/workarea/configuration/puma.rb
workarea-core-3.4.30 lib/workarea/configuration/puma.rb
workarea-core-3.4.29 lib/workarea/configuration/puma.rb
workarea-core-3.4.28 lib/workarea/configuration/puma.rb
workarea-core-3.4.27 lib/workarea/configuration/puma.rb
workarea-core-3.4.26 lib/workarea/configuration/puma.rb