Class: Puma::Configuration

### Home Classes Methods

### In Files

- lib/puma/configuration.rb

### Parent

Object

### Namespace

- CLASS Puma::Configuration::ConfigMiddleware

### Methods

- ::new
- ::temp_path
- #app
- #app_configured?
- #default_options
- #initialize_copy
- #load
- #rackup

### Included Modules

- Puma::ConfigDefault

### Files

- Manifest.txt

### Class/Module Index

Quicksearch

- Puma
- Puma::App
- Puma::App::Status
- Puma::Binder
- Puma::CLI
- Puma::Client
- Puma::Cluster
- Puma::Cluster::Worker
- Puma::CommonLogger
- Puma::ConfigDefault
- Puma::Configuration
- Puma::Configuration::ConfigMiddleware
- Puma::ConnectionError
- Puma::Const
- Puma::ControlCLI
- Puma::DSL
- Puma::Delegation
- Puma::Events
- Puma::Events::DefaultFormatter
- Puma::Events::PidFormatter
- Puma::IOBuffer
- Puma::JRubyRestart
- Puma::JavaIOBuffer
- Puma::MiniSSL
- Puma::MiniSSL::Context
- Puma::MiniSSL::SSLError
- Puma::MiniSSL::Server
- Puma::MiniSSL::Socket
- Puma::NullIO
- Puma::Rack
- Puma::Rack::Builder
- Puma::Rack::Options
- Puma::Rack::URLMap
- Puma::Reactor
- Puma::Runner
- Puma::Server
- Puma::Single
- Puma::TCPLogger
- Puma::ThreadPool
- Puma::ThreadPool::AutoTrim
- Puma::ThreadPool::Reaper
- Puma::UnsupportedOption
- Puma::Util
- Puma::Util::HeaderHash
- OpenSSL
- OpenSSL::SSL
- OpenSSL::SSL::SSLServer
- Rack
- Rack::Handler
- Rack::Handler::Puma
- IO
- IO::WaitReadable
- Object
- Process
- String

No matching classes.

# Puma::Configuration

### Attributes

options[R]

### Public Class Methods

new(options) click to toggle source

    # File lib/puma/configuration.rb, line 17
    def initialize(options)
      @cli_options = options

      @conf = {}
      @conf[:mode] ||= :http
      @conf[:binds] ||= []
      @conf[:on_restart] ||= []
      @conf[:before_fork] ||= []
      @conf[:before_worker_shutdown] ||= []
      @conf[:before_worker_boot] ||= []
      @conf[:before_worker_fork] ||= []
      @conf[:after_worker_boot] ||= []
      @conf[:worker_timeout] ||= DefaultWorkerTimeout
      @conf[:worker_shutdown_timeout] ||= DefaultWorkerShutdownTimeout

      @options = {}
    end

temp_path() click to toggle source

    # File lib/puma/configuration.rb, line 113
    def self.temp_path
      require 'tmpdir'

      t = (Time.now.to_f * 1000).to_i
      "#{Dir.tmpdir}/puma-status-#{t}-#{$$}"
    end

### Public Instance Methods

app() click to toggle source

Load the specified rackup file, pull options from the rackup file, and set @app.

    # File lib/puma/configuration.rb, line 95
    def app
      found = options[:app] || load_rackup

      if @options[:mode] == :tcp
        require 'puma/tcp_logger'

        logger = @options[:logger] || STDOUT
        return TCPLogger.new(logger, found, @options[:quiet])
      end

      if !@options[:quiet] and @options[:environment] == "development"
        logger = @options[:logger] || STDOUT
        found = CommonLogger.new(found, logger)
      end

      ConfigMiddleware.new(self, found)
    end

app_configured?() click to toggle source

Indicate if there is a properly configured app

    # File lib/puma/configuration.rb, line 84
    def app_configured?
      @options[:app] || File.exist?(rackup)
    end

default_options() click to toggle source

    # File lib/puma/configuration.rb, line 43
    def default_options
      {
        :min_threads => 0,
        :max_threads => 16,
        :quiet => false,
        :debug => false,
        :binds => [],
        :workers => 0,
        :daemon => false,
      }
    end

initialize_copy(other) click to toggle source

    # File lib/puma/configuration.rb, line 37
    def initialize_copy(other)
      @conf = nil
      @cli_options = nil
      @options = @options.dup
    end

load() click to toggle source

    # File lib/puma/configuration.rb, line 55
    def load
      DSL.load(@conf, @cli_options[:config_file])

      # Load the options in the right priority
      #
      @options.merge! default_options
      @options.merge! @conf
      @options.merge! @cli_options

      setup_binds
      setup_control
      @options[:tag] ||= infer_tag
    end

rackup() click to toggle source

    # File lib/puma/configuration.rb, line 88
    def rackup
      @options[:rackup] || DefaultRackup
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.