Compare commits

..

No commits in common. "4df27142d0efa560bd13f14cef8298ee9bceafc8" and "686b18d1f4329e80cf6d9b916eaa0c231333edb9" have entirely different histories.

View file

@ -69,11 +69,6 @@ pub const Profile = struct {
config_file: ?[]const u8 = null,
/// Config file. Defaults to AWS_PROFILE or default
profile_name: ?[]const u8 = null,
/// Profile name specified via command line should change precedence of operation,
/// moves credential file checking to the top. The sdk does not have a
/// way to know if this is coming from a command line, so this field
/// serves as a way to accomplish that task
prefer_profile_from_file: bool = false,
};
pub const Options = struct {
@ -84,15 +79,6 @@ pub var static_credentials: ?auth.Credentials = null;
pub fn getCredentials(allocator: std.mem.Allocator, options: Options) !auth.Credentials {
if (static_credentials) |c| return c;
if (options.profile.prefer_profile_from_file) {
log.debug(
"Command line profile specified. Checking credentials file first. Profile name {s}",
.{options.profile.profile_name orelse "default"},
);
if (try getProfileCredentials(allocator, options.profile)) |cred| return cred;
// Profile not found. We'll mirror the cli here and bail early
return error.CredentialsNotFound;
}
if (try getEnvironmentCredentials(allocator)) |cred| {
log.debug("Found credentials in environment. Access key: {s}", .{cred.access_key});
return cred;
@ -412,8 +398,8 @@ fn getProfileCredentials(allocator: std.mem.Allocator, options: Profile) !?auth.
default_path = default_path orelse creds_file_path.home;
const config_file_path = try filePath(
allocator,
options.config_file,
"AWS_CONFIG_FILE",
options.credential_file,
"AWS_SHARED_CREDENTIALS_FILE",
default_path,
"config",
);