class Mongrel2::Config::Server
Public Class Methods
Return the dataset for looking up a server by its UUID.
# File lib/mongrel2/config/server.rb, line 34 dataset_module do def by_uuid( uuid ) filter(:uuid => uuid).limit(1) end end
Public Instance Methods
Get the path to the server's access log as a String.
# File lib/mongrel2/config/server.rb, line 65
Get the path to the server's access log as a Pathname
# File lib/mongrel2/config/server.rb, line 69 def access_log_path path = self.access_log or return nil return Pathname( path ) end
The address to bind to on startup.
# File lib/mongrel2/config/server.rb, line 120
# File lib/mongrel2/config/server.rb, line 35 def by_uuid( uuid ) filter(:uuid => uuid).limit(1) end
Get the name of the directory Mongrel2
will chroot to if run as root as a String.
# File lib/mongrel2/config/server.rb, line 87
Return a Pathname for the server's chroot directory.
# File lib/mongrel2/config/server.rb, line 92 def chroot_path path = self.chroot or return nil return Pathname( path ) end
Return the Mongrel2::Control
object for the server's control socket.
# File lib/mongrel2/config/server.rb, line 170 def control_socket return Mongrel2::Control.new( self.control_socket_uri ) end
Return the URI for its control socket.
# 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
Get the name of the default virtualhost for the server. If none of the hosts' names (or matching pattern) matches the request's Host: header, the default_host
will be used.
# File lib/mongrel2/config/server.rb, line 110
Get the path tot he server's error log as a String.
# File lib/mongrel2/config/server.rb, line 76
Get the path to the server's error log as a Pathname
# File lib/mongrel2/config/server.rb, line 80 def error_log_path path = self.error_log or return nil return Pathname( path ) end
The filters that will be loaded by this server.
# File lib/mongrel2/config/server.rb, line 47 one_to_many :filters
The hosts that belong to this server.
# File lib/mongrel2/config/server.rb, line 43 one_to_many :hosts
The huamn-readable name of the server.
# File lib/mongrel2/config/server.rb, line 116
Get the path to the server's PID file as a String.
# File lib/mongrel2/config/server.rb, line 99
The path to the server's PID file as a Pathname.
# File lib/mongrel2/config/server.rb, line 103 def pid_file_path path = self.pid_file or return nil return Pathname( path ) end
The port to listen on.
# File lib/mongrel2/config/server.rb, line 124
Stringification method – return a human-readable description of the server.
# 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
If enabled
, the server will use SSL.
# File lib/mongrel2/config/server.rb, line 135 def use_ssl=( enabled ) if !enabled || enabled == 0 super( 0 ) else super( 1 ) end end
Returns true
if the server uses SSL.
# File lib/mongrel2/config/server.rb, line 129 def use_ssl? return self.use_ssl.nonzero? end
Get the server identifier, which is typically a UUID, but can in reality be any string of alphanumeric characters and dashes.
# File lib/mongrel2/config/server.rb, line 56
Set the server identifier.
# File lib/mongrel2/config/server.rb, line 61
Sequel validation callback: add errors if the record is invalid.
# 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
The xrequest handlers that will be loaded by this server.
# File lib/mongrel2/config/server.rb, line 51 one_to_many :xrequests, :class => 'Mongrel2::Config::XRequest'