Class: ResqueToCloudwatch::Config
- Inherits:
-
Object
- Object
- ResqueToCloudwatch::Config
- Defined in:
- lib/resque_to_cloudwatch/config.rb
Instance Attribute Summary collapse
-
#access_key_id ⇒ Object
readonly
Returns the value of attribute access_key_id.
-
#enable_graphite ⇒ Object
readonly
Returns the value of attribute enable_graphite.
-
#graphite_host ⇒ Object
readonly
Returns the value of attribute graphite_host.
-
#graphite_port ⇒ Object
readonly
Returns the value of attribute graphite_port.
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#period ⇒ Object
readonly
Returns the value of attribute period.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#redis_host ⇒ Object
readonly
Returns the value of attribute redis_host.
-
#redis_port ⇒ Object
readonly
Returns the value of attribute redis_port.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#secret_access_key ⇒ Object
readonly
Returns the value of attribute secret_access_key.
Instance Method Summary collapse
-
#initialize(path) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(path) ⇒ Config
Returns a new instance of Config.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/resque_to_cloudwatch/config.rb', line 12 def initialize(path) $log.info "Loading configuration" raise "Config file #{path} not found or readable" unless File.exists?(path) @required_opts = %w{access_key_id secret_access_key project period region redis_host redis_port namespace} @hash = YAML.load_file(path) raise "Config file #{path} is empty" unless @hash validate_config @hash.each_pair do |opt,value| # Support old-style where region is not an array if opt == 'region' && value.is_a?(String) value = [value] end instance_variable_set("@#{opt}", value) $log.info "Config parameter: #{opt} is #{value}" end # Set up AWS credentials AWS.config( :access_key_id => @hash['access_key_id'], :secret_access_key => @hash['secret_access_key'] ) end |
Instance Attribute Details
#access_key_id ⇒ Object (readonly)
Returns the value of attribute access_key_id.
7 8 9 |
# File 'lib/resque_to_cloudwatch/config.rb', line 7 def access_key_id @access_key_id end |
#enable_graphite ⇒ Object (readonly)
Returns the value of attribute enable_graphite.
9 10 11 |
# File 'lib/resque_to_cloudwatch/config.rb', line 9 def enable_graphite @enable_graphite end |
#graphite_host ⇒ Object (readonly)
Returns the value of attribute graphite_host.
9 10 11 |
# File 'lib/resque_to_cloudwatch/config.rb', line 9 def graphite_host @graphite_host end |
#graphite_port ⇒ Object (readonly)
Returns the value of attribute graphite_port.
9 10 11 |
# File 'lib/resque_to_cloudwatch/config.rb', line 9 def graphite_port @graphite_port end |
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
8 9 10 |
# File 'lib/resque_to_cloudwatch/config.rb', line 8 def hostname @hostname end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
10 11 12 |
# File 'lib/resque_to_cloudwatch/config.rb', line 10 def namespace @namespace end |
#period ⇒ Object (readonly)
Returns the value of attribute period.
7 8 9 |
# File 'lib/resque_to_cloudwatch/config.rb', line 7 def period @period end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
7 8 9 |
# File 'lib/resque_to_cloudwatch/config.rb', line 7 def project @project end |
#redis_host ⇒ Object (readonly)
Returns the value of attribute redis_host.
8 9 10 |
# File 'lib/resque_to_cloudwatch/config.rb', line 8 def redis_host @redis_host end |
#redis_port ⇒ Object (readonly)
Returns the value of attribute redis_port.
8 9 10 |
# File 'lib/resque_to_cloudwatch/config.rb', line 8 def redis_port @redis_port end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
7 8 9 |
# File 'lib/resque_to_cloudwatch/config.rb', line 7 def region @region end |
#secret_access_key ⇒ Object (readonly)
Returns the value of attribute secret_access_key.
7 8 9 |
# File 'lib/resque_to_cloudwatch/config.rb', line 7 def secret_access_key @secret_access_key end |