Class: Redirus::Config
- Inherits:
-
Object
- Object
- Redirus::Config
- Defined in:
- lib/redirus/config.rb
Instance Method Summary collapse
- #allowed_properties ⇒ Object
- #config_template ⇒ 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
61 62 63 |
# File 'lib/redirus/config.rb', line 61 def allowed_properties nginx_prop :allowed_properties, [] end |
#config_template ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/redirus/config.rb', line 46 def config_template nginx_prop :config_template, %q[#{upstream} server { #{listen} server_name #{name}.localhost; server_tokens off; location / { proxy_pass http://#{upstream_name}; } }] 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, 'listen *:80;' end |
#https_template ⇒ Object
39 40 41 42 43 44 |
# File 'lib/redirus/config.rb', line 39 def https_template nginx_prop :https_template, %q[listen *:443 ssl; ssl_certificate /usr/share/ssl/certs/localhost/host.cert; ssl_certificate_key /usr/share/ssl/certs/localhost/host.key; ] 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 |