Class: Landlord::Config

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/landlord/config.rb

Constant Summary collapse

DEFAULTS =

Constants ============================================================

{
  :config_file => '/etc/landlord.conf'.freeze,
  :template_dir => '/etc/landlord'.freeze,
  :virtual_host_base_dir => '/web'.freeze,
  :virtual_host_config_dir => '/etc/httpd/vhosts.d'.freeze,
  :server_type => :apache,
  :virtual_host_subdirs => %w[ . shared shared/log shared/config releases ]
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(config_file = nil) ⇒ Config

Instance Methods =====================================================



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/landlord/config.rb', line 19

def initialize(config_file = nil)
  config = DEFAULTS
  
  if (config_file and File.exist?(config_file))
    config = DEFAULTS.merge(YAML.load(File.read(config_file)))
  end
  
  super(config)
  
  self.disabled_virtual_host_config_dir ||= File.expand_path(
    'disabled',
    self.virtual_host_config_dir
  )
end