Class: Hibernate::ConfigLoader
- Inherits:
-
Object
- Object
- Hibernate::ConfigLoader
- Defined in:
- lib/hibernate/config_loader.rb
Instance Method Summary collapse
- #aws_credentials ⇒ Object
-
#initialize(config_path = 'config.yaml') ⇒ ConfigLoader
constructor
A new instance of ConfigLoader.
Constructor Details
#initialize(config_path = 'config.yaml') ⇒ ConfigLoader
Returns a new instance of ConfigLoader.
5 6 7 8 9 10 |
# File 'lib/hibernate/config_loader.rb', line 5 def initialize(config_path = 'config.yaml') @config_path = config_path @config = load_config @profile = ENV['AWS_PROFILE'] || default_profile validate_config end |
Instance Method Details
#aws_credentials ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/hibernate/config_loader.rb', line 12 def aws_credentials account_config = @config.dig('aws_accounts', @profile) if account_config.nil? raise "Profile #{@profile} not found in the configuration file." end { account_id: account_config['account_id'], region: account_config['region'], access_key_id: account_config.dig('credentials', 'access_key_id'), secret_access_key: account_config.dig('credentials', 'secret_access_key') } end |