Class: M2Config::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/m2config/server.rb

Constant Summary collapse

ACCESS_LOG =
'/logs/access.log'
ERROR_LOG =
'/logs/error.log'
PID_FILE =
'/run/mongrel2.pid'
CONTROL_PORT =
''
CHROOT =
'./'
DEFAULT_HOST =
'localhost'
NAME =
'main'
BIND_ADDR =
'0.0.0.0'
PORT =
6767
USE_SSL =
0

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fields = {}) ⇒ Server

Returns a new instance of Server.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/m2config/server.rb', line 16

def initialize( fields={} )
  fields[:uuid]         ||= UUID.new.generate
  fields[:access_log]   ||= M2Config::Server::ACCESS_LOG
  fields[:error_log]    ||= ERROR_LOG
  fields[:pid_file]     ||= PID_FILE
  fields[:chroot]       ||= CHROOT
  fields[:default_host] ||= DEFAULT_HOST
  fields[:name]         ||= NAME
  fields[:bind_addr]    ||= BIND_ADDR
  fields[:port]         ||= PORT
  fields[:use_ssl]      ||= USE_SSL
  fields[:control_port] ||= CONTROL_PORT
  super fields, false
  save
end

Class Method Details

.firstObject



32
33
34
35
36
# File 'lib/m2config/server.rb', line 32

def self.first
  raise "Careful ! You are calling Server.first on a database holding multiple servers" if
    ((Server.get {count(id)}) > 1)
  super
end