Class: Redirus::Config

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

Instance Method Summary collapse

Constructor Details

#initialize(path = nil) ⇒ Config

Returns a new instance of Config.



7
8
9
10
11
12
13
# File 'lib/redirus/config.rb', line 7

def initialize(path=nil)
  if File.exists?(path)
    @config = YAML.load_file(path)
  else
    @config = {}
  end
end

Instance Method Details

#allowed_propertiesObject



43
44
45
# File 'lib/redirus/config.rb', line 43

def allowed_properties
  nginx_prop :allowed_properties, []
end

#configs_pathObject



31
32
33
# File 'lib/redirus/config.rb', line 31

def configs_path
  nginx_prop :configs_path, 'sites-enabled'
end

#http_templateObject



35
36
37
# File 'lib/redirus/config.rb', line 35

def http_template
  nginx_prop :http_template, 'http.conf.erb'
end

#https_templateObject



39
40
41
# File 'lib/redirus/config.rb', line 39

def https_template
  nginx_prop :https_template, 'https.conf.erb'
end

#namespaceObject



23
24
25
# File 'lib/redirus/config.rb', line 23

def namespace
  @config['namespace'] || 'redirus'
end

#nginx_pid_fileObject



27
28
29
# File 'lib/redirus/config.rb', line 27

def nginx_pid_file
  nginx_prop :pid, 'nginx.pid'
end

#queuesObject



15
16
17
# File 'lib/redirus/config.rb', line 15

def queues
  @config['queues'] || ['default']
end

#redis_urlObject



19
20
21
# File 'lib/redirus/config.rb', line 19

def redis_url
  @config['redis_url'] || 'redis://localhost:6379'
end