Class: Mongrel2::Config::Server
- Inherits:
-
Object
- Object
- Mongrel2::Config::Server
- Includes:
- Mongrel2::Constants
- Defined in:
- lib/mongrel2/config/server.rb
Overview
Mongrel2 Server configuration class
Defined Under Namespace
Modules: DSLMethods
Constant Summary
Constants included from Mongrel2::Constants
Mongrel2::Constants::DATA_DIR, Mongrel2::Constants::DEFAULT_CONFIG_SCRIPT, Mongrel2::Constants::DEFAULT_CONFIG_URI, Mongrel2::Constants::DEFAULT_CONTROL_SOCKET, Mongrel2::Constants::MAX_BROADCAST_IDENTS
Instance Method Summary collapse
-
#access_log_path ⇒ Object
Get the path to the server’s access log as a Pathname.
-
#chroot_path ⇒ Object
Return a Pathname for the server’s chroot directory.
-
#control_socket ⇒ Object
Return the Mongrel2::Control object for the server’s control socket.
-
#control_socket_uri ⇒ Object
Return the URI for its control socket.
-
#error_log_path ⇒ Object
Get the path to the server’s error log as a Pathname.
-
#filters ⇒ Object
The filters that will be loaded by this server.
-
#hosts ⇒ Object
The hosts that belong to this server.
-
#pid_file_path ⇒ Object
The path to the server’s PID file as a Pathname.
-
#to_s ⇒ Object
Stringification method – return a human-readable description of the server.
-
#use_ssl=(enabled) ⇒ Object
If
enabled
, the server will use SSL. -
#use_ssl? ⇒ Boolean
Returns
true
if the server uses SSL. -
#validate ⇒ Object
Sequel validation callback: add errors if the record is invalid.
-
#xrequests ⇒ Object
The xrequest handlers that will be loaded by this server.
Instance Method Details
#access_log_path ⇒ Object
Get the path to the server’s access log as a Pathname
69 70 71 72 |
# File 'lib/mongrel2/config/server.rb', line 69 def access_log_path path = self.access_log or return nil return Pathname( path ) end |
#chroot_path ⇒ Object
Return a Pathname for the server’s chroot directory.
92 93 94 95 |
# File 'lib/mongrel2/config/server.rb', line 92 def chroot_path path = self.chroot or return nil return Pathname( path ) end |
#control_socket ⇒ Object
Return the Mongrel2::Control object for the server’s control socket.
170 171 172 |
# File 'lib/mongrel2/config/server.rb', line 170 def control_socket return Mongrel2::Control.new( self.control_socket_uri ) end |
#control_socket_uri ⇒ Object
Return the URI for its control socket.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/mongrel2/config/server.rb', line 145 def control_socket_uri # Find the control socket relative to the server's chroot csock_uri = Mongrel2::Config.settings[:control_port] || DEFAULT_CONTROL_SOCKET self.log.debug "Chrooted control socket uri is: %p" % [ csock_uri ] scheme, sock_path = csock_uri.split( '://', 2 ) self.log.debug " chrooted socket path is: %p" % [ sock_path ] csock_path = self.chroot_path + sock_path if csock_path.socket? self.log.debug " socket path is relative to the chroot: %p" % [ csock_path ] else csock_path = Pathname.pwd + sock_path raise "Unable to find the socket path %p" % [ csock_uri ] unless csock_path.socket? self.log.debug " socket path is relative to the PWD: %p" % [ csock_path ] end csock_uri = "%s://%s" % [ scheme, csock_path ] self.log.debug " control socket URI is: %p" % [ csock_uri ] return csock_uri end |
#error_log_path ⇒ Object
Get the path to the server’s error log as a Pathname
80 81 82 83 |
# File 'lib/mongrel2/config/server.rb', line 80 def error_log_path path = self.error_log or return nil return Pathname( path ) end |
#filters ⇒ Object
The filters that will be loaded by this server.
47 |
# File 'lib/mongrel2/config/server.rb', line 47 one_to_many :filters |
#hosts ⇒ Object
The hosts that belong to this server.
43 |
# File 'lib/mongrel2/config/server.rb', line 43 one_to_many :hosts |
#pid_file_path ⇒ Object
The path to the server’s PID file as a Pathname.
103 104 105 106 |
# File 'lib/mongrel2/config/server.rb', line 103 def pid_file_path path = self.pid_file or return nil return Pathname( path ) end |
#to_s ⇒ Object
Stringification method – return a human-readable description of the server.
183 184 185 |
# File 'lib/mongrel2/config/server.rb', line 183 def to_s return "%s {%s} %s:%d" % [ self.name, self.uuid, self.bind_addr, self.port ] end |
#use_ssl=(enabled) ⇒ Object
If enabled
, the server will use SSL.
135 136 137 138 139 140 141 |
# File 'lib/mongrel2/config/server.rb', line 135 def use_ssl=( enabled ) if !enabled || enabled == 0 super( 0 ) else super( 1 ) end end |
#use_ssl? ⇒ Boolean
Returns true
if the server uses SSL.
129 130 131 |
# File 'lib/mongrel2/config/server.rb', line 129 def use_ssl? return self.use_ssl.nonzero? end |
#validate ⇒ Object
Sequel validation callback: add errors if the record is invalid.
176 177 178 179 |
# File 'lib/mongrel2/config/server.rb', line 176 def validate self.validates_presence [ :access_log, :error_log, :pid_file, :default_host, :port ], message: 'is missing or nil' end |
#xrequests ⇒ Object
The xrequest handlers that will be loaded by this server.
51 52 |
# File 'lib/mongrel2/config/server.rb', line 51 one_to_many :xrequests, :class => 'Mongrel2::Config::XRequest' |