Class: Waitress::Configuration
- Inherits:
-
Object
- Object
- Waitress::Configuration
- Defined in:
- lib/waitress/configure.rb
Overview
The Configuration Class is the object that contains a configuration of a single server instance, hosting all the methods provided by Waitress.configure!
Instance Attribute Summary collapse
-
#hosts ⇒ Object
Returns the value of attribute hosts.
-
#internal_error ⇒ Object
Returns the value of attribute internal_error.
-
#ports ⇒ Object
Returns the value of attribute ports.
-
#processes ⇒ Object
Returns the value of attribute processes.
Instance Method Summary collapse
-
#all_hosts(&block) ⇒ Object
Over all the registered VHosts, call this method.
-
#detailed_500(enabled) ⇒ Object
Set to true to enable 500 error backtraces in the browser.
-
#host(regex, priority = 50, &block) ⇒ Object
Create a new VirtualHost with the given regex, priority, and configure it inside of its own block.
-
#initialize(configure, *ports) ⇒ Configuration
constructor
A new instance of Configuration.
-
#less_watch(time) ⇒ Object
Set the watch period for the LESS Watcher, i.e.
- #to_s ⇒ Object
Constructor Details
#initialize(configure, *ports) ⇒ Configuration
Returns a new instance of Configuration.
90 91 92 93 94 95 96 97 98 |
# File 'lib/waitress/configure.rb', line 90 def initialize configure, *ports @ports = *ports @hosts = [] @configure = configure @internal_error = false @processes = 5 @processes = ENV["WAITRESS_PROCESSES"].to_i if ENV.include? "WAITRESS_PROCESSES" end |
Instance Attribute Details
#hosts ⇒ Object
Returns the value of attribute hosts.
85 86 87 |
# File 'lib/waitress/configure.rb', line 85 def hosts @hosts end |
#internal_error ⇒ Object
Returns the value of attribute internal_error.
88 89 90 |
# File 'lib/waitress/configure.rb', line 88 def internal_error @internal_error end |
#ports ⇒ Object
Returns the value of attribute ports.
86 87 88 |
# File 'lib/waitress/configure.rb', line 86 def ports @ports end |
#processes ⇒ Object
Returns the value of attribute processes.
87 88 89 |
# File 'lib/waitress/configure.rb', line 87 def processes @processes end |
Instance Method Details
#all_hosts(&block) ⇒ Object
Over all the registered VHosts, call this method. Use this to configure a similar setting for all vhosts at once instead of duplicating code across all of them.
113 114 115 |
# File 'lib/waitress/configure.rb', line 113 def all_hosts &block @hosts.each { |h| block.call(h) } end |
#detailed_500(enabled) ⇒ Object
Set to true to enable 500 error backtraces in the browser
124 125 126 |
# File 'lib/waitress/configure.rb', line 124 def detailed_500 enabled @internal_error = enabled end |
#host(regex, priority = 50, &block) ⇒ Object
Create a new VirtualHost with the given regex, priority, and configure it inside of its own block.
102 103 104 105 106 107 108 |
# File 'lib/waitress/configure.rb', line 102 def host regex, priority=50, &block host = Waitress::Vhost.new regex, priority host.set_configure @configure block.call(host) @hosts << host host end |
#less_watch(time) ⇒ Object
Set the watch period for the LESS Watcher, i.e. how long to sleep before checking LESS files for an update and recompile
119 120 121 |
# File 'lib/waitress/configure.rb', line 119 def less_watch time Waitress::LESSWatcher.set_time time end |
#to_s ⇒ Object
128 129 130 131 |
# File 'lib/waitress/configure.rb', line 128 def to_s m = lambda { |a,x| x.nil? ? "" : "\r\n#{a}=#{x.inspect}" } "#<#{self.class} #{m.call('ports', @ports)} #{m.call('hosts', @hosts)}>" end |