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
70 71 72 73 |
# File 'lib/mongrel2/config/server.rb', line 70 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.
93 94 95 96 |
# File 'lib/mongrel2/config/server.rb', line 93 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.
171 172 173 |
# File 'lib/mongrel2/config/server.rb', line 171 def control_socket return Mongrel2::Control.new( self.control_socket_uri ) end |
#control_socket_uri ⇒ Object
Return the URI for its control socket.
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/mongrel2/config/server.rb', line 146 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
81 82 83 84 |
# File 'lib/mongrel2/config/server.rb', line 81 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.
48 |
# File 'lib/mongrel2/config/server.rb', line 48 one_to_many :filters |
#hosts ⇒ Object
The hosts that belong to this server.
44 |
# File 'lib/mongrel2/config/server.rb', line 44 one_to_many :hosts |
#pid_file_path ⇒ Object
The path to the server’s PID file as a Pathname.
104 105 106 107 |
# File 'lib/mongrel2/config/server.rb', line 104 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.
184 185 186 |
# File 'lib/mongrel2/config/server.rb', line 184 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.
136 137 138 139 140 141 142 |
# File 'lib/mongrel2/config/server.rb', line 136 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.
130 131 132 |
# File 'lib/mongrel2/config/server.rb', line 130 def use_ssl? return self.use_ssl.nonzero? end |
#validate ⇒ Object
Sequel validation callback: add errors if the record is invalid.
177 178 179 180 |
# File 'lib/mongrel2/config/server.rb', line 177 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.
52 53 |
# File 'lib/mongrel2/config/server.rb', line 52 one_to_many :xrequests, :class => 'Mongrel2::Config::XRequest' |