The methods that are available for use inside the config file.
# File lib/puma/configuration.rb, line 115 def initialize(options) @options = options end
# File lib/puma/configuration.rb, line 119 def _load_from(path) instance_eval File.read(path), path, 1 end
Start the Puma control rack app on
url
. This app can be communicated with to control the main
server.
# File lib/puma/configuration.rb, line 137 def activate_control_app(url="auto", opts=nil) @options[:control_url] = url if opts if tok = opts[:auth_token] @options[:control_auth_token] = tok end if opts[:no_token] @options[:control_auth_token] = :none end end end
Use obj
or block
as the Rack app. This allows a config file to be the
app itself.
# File lib/puma/configuration.rb, line 126 def app(obj=nil, &block) obj ||= block raise "Provide either a #call'able or a block" unless obj @options[:app] = obj end
Bind the server to url
. tcp:// and unix:// are the only
accepted protocols.
# File lib/puma/configuration.rb, line 154 def bind(url) @options[:binds] << url end
Set the environment in which the Rack’s app will run.
# File lib/puma/configuration.rb, line 213 def environment(environment) @options[:environment] = environment end
Code to run before doing a restart. This code should close logfiles, database connections, etc.
This can be called multiple times to add code each time.
# File lib/puma/configuration.rb, line 163 def on_restart(&blk) @options[:on_restart] << blk end
Store the pid of the server in the file at path
.
# File lib/puma/configuration.rb, line 168 def pidfile(path) @options[:pidfile] = path end
Disable request logging.
# File lib/puma/configuration.rb, line 174 def quiet @options[:quiet] = true end
Load path
as a rackup file.
# File lib/puma/configuration.rb, line 180 def rackup(path) @options[:rackup] = path.to_s end
# File lib/puma/configuration.rb, line 196 def ssl_bind(host, port, opts) o = [ "cert=#{opts[:cert]}", "key=#{opts[:key]}" ] @options[:binds] << "ssl://#{host}:#{port}?#{o.join('&')}" end
Use path
as the file to store the server info state. This is
used by pumactl to query and control the server.
# File lib/puma/configuration.rb, line 208 def state_path(path) @options[:state] = path.to_s end
Configure min
to be the minimum number of threads to use to
answer requests and max
the maximum.
# File lib/puma/configuration.rb, line 187 def threads(min, max) if min > max raise "The minimum number of threads must be less than the max" end @options[:min_threads] = min @options[:max_threads] = max end