Class: Redirus::Config
- Inherits:
-
Object
- Object
- Redirus::Config
- Defined in:
- lib/redirus/config.rb
Instance Method Summary collapse
- #allowed_properties ⇒ Object
- #configs_path ⇒ Object
- #http_template ⇒ Object
- #https_template ⇒ Object
-
#initialize(path = nil) ⇒ Config
constructor
A new instance of Config.
- #namespace ⇒ Object
- #nginx_pid_file ⇒ Object
- #queues ⇒ Object
- #redis_url ⇒ Object
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_properties ⇒ Object
43 44 45 |
# File 'lib/redirus/config.rb', line 43 def allowed_properties nginx_prop :allowed_properties, [] end |
#configs_path ⇒ Object
31 32 33 |
# File 'lib/redirus/config.rb', line 31 def configs_path nginx_prop :configs_path, 'sites-enabled' end |
#http_template ⇒ Object
35 36 37 |
# File 'lib/redirus/config.rb', line 35 def http_template nginx_prop :http_template, 'http.conf.erb' end |
#https_template ⇒ Object
39 40 41 |
# File 'lib/redirus/config.rb', line 39 def https_template nginx_prop :https_template, 'https.conf.erb' end |
#namespace ⇒ Object
23 24 25 |
# File 'lib/redirus/config.rb', line 23 def namespace @config['namespace'] || 'redirus' end |
#nginx_pid_file ⇒ Object
27 28 29 |
# File 'lib/redirus/config.rb', line 27 def nginx_pid_file nginx_prop :pid, 'nginx.pid' end |
#queues ⇒ Object
15 16 17 |
# File 'lib/redirus/config.rb', line 15 def queues @config['queues'] || ['default'] end |
#redis_url ⇒ Object
19 20 21 |
# File 'lib/redirus/config.rb', line 19 def redis_url @config['redis_url'] || 'redis://localhost:6379' end |