Skip to content

Commit

Permalink
Merge pull request #5016 from systeminit/feat/implement-instance-cred…
Browse files Browse the repository at this point in the history
…s-for-module-index

feat: expand AWS Credentials chain for Module Index
  • Loading branch information
johnrwatson authored Nov 22, 2024
2 parents 31b321d + ace5b45 commit 7669589
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/module-index-server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,20 @@ impl Server<(), ()> {
}
(None, None) => match AwsCredentials::from_env() {
Ok(creds) => creds,
Err(CredentialsError::MissingEnvVar(_, _)) => AwsCredentials::from_profile(None)?,
Err(CredentialsError::MissingEnvVar(_, _)) => {
// Attempt to load from local AWS Profile
match AwsCredentials::from_profile(None) {
Ok(creds) => creds,
Err(CredentialsError::ConfigNotFound) => {
// Attempt to load from instance metadata
match AwsCredentials::from_instance_metadata() {
Ok(creds) => creds,
Err(err) => return Err(err.into()),
}
}
Err(err) => return Err(err.into()),
}
}
Err(err) => return Err(err.into()),
},
_ => {
Expand Down

0 comments on commit 7669589

Please sign in to comment.