Skip to content

Profile loading is reading the credentials file instead of the config file #111

@jtanx

Description

@jtanx

I've noticed that this extension is ignoring source_profile as defined in ~/.aws/config.

Based on some cursory searches, it seems that this is because GetProfile is trying to read the profiles out of the credentials file (~/.aws/credentials) instead of the config file:

Aws::Config::Profile selected_profile;
// get file path where aws credentials are stored.
// comes from AWS_SHARED_CREDENTIALS_FILE
auto credentials_file_path = Aws::Auth::ProfileConfigFileAWSCredentialsProvider::GetCredentialsProfileFilename();
// get the profile from within that file
Aws::Map<Aws::String, Aws::Config::Profile> profiles;
Aws::Config::AWSConfigFileProfileConfigLoader loader(credentials_file_path);
if (loader.Load()) {
profiles = loader.GetProfiles();
for (const auto &entry : profiles) {
const Aws::String &profileName = entry.first;
if (profileName == profile_name) {
selected_profile = entry.second;
auto &url = selected_profile.GetValue("endpoint");
return selected_profile;
}
}
} else {
throw InvalidInputException("Failed to load credentials file %s", credentials_file_path);
}
- by using GetCredentialsProfileFilename instead of GetConfigProfileFilename. Is there any known reason for this or should this just be changed to read out of the config file instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions