Class: OpenStudio::Aws::Config
- Inherits:
-
Object
- Object
- OpenStudio::Aws::Config
- Defined in:
- lib/openstudio/aws/config.rb
Instance Attribute Summary collapse
-
#access_key ⇒ Object
Returns the value of attribute access_key.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
Instance Method Summary collapse
-
#initialize(yml_config_file = nil) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(yml_config_file = nil) ⇒ Config
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/openstudio/aws/config.rb', line 7 def initialize(yml_config_file = nil) @yml_config_file = yml_config_file @config = nil if @yml_config_file.nil? @yml_config_file = File.join(File.('~'), 'aws_config.yml') unless File.exist?(@yml_config_file) write_config_file fail "No Config File in user home directory. A template has been added, please edit and save: #{@yml_config_file}" exit 1 end end begin @config = YAML.load(File.read(@yml_config_file)) @access_key = @config['access_key_id'] @secret_key = @config['secret_access_key'] rescue raise "Couldn't read config file #{@yml_config_file}. Delete file then recreate by rerunning script" end end |
Instance Attribute Details
#access_key ⇒ Object
Returns the value of attribute access_key.
4 5 6 |
# File 'lib/openstudio/aws/config.rb', line 4 def access_key @access_key end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
5 6 7 |
# File 'lib/openstudio/aws/config.rb', line 5 def secret_key @secret_key end |