@api private
@return [String]
@return [String]
@option [String] :path @option [String] :profile_name
# File lib/aws/core/credential_providers.rb, line 291 def initialize(options = {}) @path = options[:path] || shared_credential_file_path @profile_name = options[:profile_name] @profile_name ||= ENV['AWS_PROFILE'] @profile_name ||= 'default' end
(see AWS::Core::CredentialProviders::Provider#get_credentials)
# File lib/aws/core/credential_providers.rb, line 305 def get_credentials if File.exist?(path) && File.readable?(path) load_from_path else {} end end
# File lib/aws/core/credential_providers.rb, line 315 def load_from_path profile = load_profile KEY_MAP.inject({}) do |credentials, (source, target)| credentials[target] = profile[source] if profile.key?(source) credentials end end
# File lib/aws/core/credential_providers.rb, line 323 def load_profile ini = IniParser.parse(File.read(path)) ini[profile_name] || {} end