Class: Elasticdns::Config
- Inherits:
-
Object
- Object
- Elasticdns::Config
- Defined in:
- lib/config.rb
Instance Attribute Summary collapse
-
#bind9_acl_masters_file ⇒ Object
Returns the value of attribute bind9_acl_masters_file.
-
#bind9_checkconf_path ⇒ Object
Returns the value of attribute bind9_checkconf_path.
-
#bind9_checkzone_path ⇒ Object
Returns the value of attribute bind9_checkzone_path.
-
#bind9_init_cmd ⇒ Object
Returns the value of attribute bind9_init_cmd.
-
#bind9_masters ⇒ Object
Returns the value of attribute bind9_masters.
-
#bind9_named_conf_file ⇒ Object
Returns the value of attribute bind9_named_conf_file.
-
#bind9_notify_file ⇒ Object
Returns the value of attribute bind9_notify_file.
-
#bind9_zone_files ⇒ Object
Returns the value of attribute bind9_zone_files.
-
#ec2_access_key_id ⇒ Object
Returns the value of attribute ec2_access_key_id.
-
#ec2_attribute ⇒ Object
Returns the value of attribute ec2_attribute.
-
#ec2_secret_access_key ⇒ Object
Returns the value of attribute ec2_secret_access_key.
Instance Method Summary collapse
- #from_file(config_file) ⇒ Object
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
- #split(param) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/config.rb', line 5 def initialize(={}) @config_from_file = from_file([:config_file]) @test = [:test] @slave =[:slave] @debug = [:debug] || (@config_from_file['debug'] if @config_from_file) @ec2_access_key_id = [:ec2_access_key_id] || (@config_from_file['ec2']['access_key_id'] if @config_from_file) @ec2_secret_access_key = [:ec2_secret_access_key] || (@config_from_file['ec2']['secret_access_key'] if @config_from_file) @ec2_region = [:ec2_region] || (@config_from_file['ec2']['region'] if @config_from_file) @ec2_tag_attribute = [:ec2_tag_attribute] || (@config_from_file['ec2']['tag_attribute'] if @config_from_file) @ec2_ip_attribute = [:ec2_ip_attribute] || (@config_from_file['ec2']['ip_attribute'] if @config_from_file) @bind9_notify_file = [:bind9_notify_file] || (@config_from_file['bind9']['notify_file'] if @config_from_file) @bind9_acl_masters_file = [:bind9_acl_masters_file] || (@config_from_file['bind9']['acl_masters_file'] if @config_from_file) @bind9_named_conf_file = [:bind9_named_conf_file] || (@config_from_file['bind9']['named_conf_file'] if @config_from_file) @bind9_zone_files = split([:bind9_zone_files]) || (@config_from_file['bind9']['zone_files'] if @config_from_file) @bind9_checkconf_path = [:bind9_checkconf_path] || (@config_from_file['bind9']['checkconf_path'] if @config_from_file) @bind9_checkzone_path = [:bind9_checkzone_path] || (@config_from_file['bind9']['checkzone_path'] if @config_from_file) @bind9_init_cmd = [:bind9_init_cmd] || (@config_from_file['bind9']['init_cmd'] if @config_from_file) @bind9_masters = split([:bind9_masters]) || (@config_from_file['bind9']['masters'] if @config_from_file) end |
Instance Attribute Details
#bind9_acl_masters_file ⇒ Object
Returns the value of attribute bind9_acl_masters_file.
3 4 5 |
# File 'lib/config.rb', line 3 def bind9_acl_masters_file @bind9_acl_masters_file end |
#bind9_checkconf_path ⇒ Object
Returns the value of attribute bind9_checkconf_path.
3 4 5 |
# File 'lib/config.rb', line 3 def bind9_checkconf_path @bind9_checkconf_path end |
#bind9_checkzone_path ⇒ Object
Returns the value of attribute bind9_checkzone_path.
3 4 5 |
# File 'lib/config.rb', line 3 def bind9_checkzone_path @bind9_checkzone_path end |
#bind9_init_cmd ⇒ Object
Returns the value of attribute bind9_init_cmd.
3 4 5 |
# File 'lib/config.rb', line 3 def bind9_init_cmd @bind9_init_cmd end |
#bind9_masters ⇒ Object
Returns the value of attribute bind9_masters.
3 4 5 |
# File 'lib/config.rb', line 3 def bind9_masters @bind9_masters end |
#bind9_named_conf_file ⇒ Object
Returns the value of attribute bind9_named_conf_file.
3 4 5 |
# File 'lib/config.rb', line 3 def bind9_named_conf_file @bind9_named_conf_file end |
#bind9_notify_file ⇒ Object
Returns the value of attribute bind9_notify_file.
3 4 5 |
# File 'lib/config.rb', line 3 def bind9_notify_file @bind9_notify_file end |
#bind9_zone_files ⇒ Object
Returns the value of attribute bind9_zone_files.
3 4 5 |
# File 'lib/config.rb', line 3 def bind9_zone_files @bind9_zone_files end |
#ec2_access_key_id ⇒ Object
Returns the value of attribute ec2_access_key_id.
3 4 5 |
# File 'lib/config.rb', line 3 def ec2_access_key_id @ec2_access_key_id end |
#ec2_attribute ⇒ Object
Returns the value of attribute ec2_attribute.
3 4 5 |
# File 'lib/config.rb', line 3 def ec2_attribute @ec2_attribute end |
#ec2_secret_access_key ⇒ Object
Returns the value of attribute ec2_secret_access_key.
3 4 5 |
# File 'lib/config.rb', line 3 def ec2_secret_access_key @ec2_secret_access_key end |
Instance Method Details
#from_file(config_file) ⇒ Object
41 42 43 44 45 |
# File 'lib/config.rb', line 41 def from_file(config_file) if config_file && File.exists?(config_file) YAML.load_file(config_file) end end |
#split(param) ⇒ Object
29 30 31 32 33 |
# File 'lib/config.rb', line 29 def split(param) if param param.split(',') end end |
#to_hash ⇒ Object
35 36 37 38 39 |
# File 'lib/config.rb', line 35 def to_hash hash = {} self.instance_variables.each {|var| hash[var.to_s.delete("@").to_sym] = self.instance_variable_get(var) } return hash end |