Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/utils/configure-aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,23 @@ function isValidEndpointUrl(url: string | undefined): boolean {
}
}

function checkIfConfigNeedsOverride(section: IniSection | undefined): boolean {
async function checkIfConfigNeedsOverride(
section: IniSection | undefined,
): Promise<boolean> {
if (!section) {
return true; // profile doesn't exist
}

if (
section.properties.endpoint_url === "http://localhost.localstack.cloud:4566"
) {
const isDnsResolved = await dnsResolveCheck(undefined);
if (!isDnsResolved) {
// if DNS is not resolved, we need to override the endpoint_url
return true;
}
}

return !(
section.properties.region &&
section.properties.endpoint_url &&
Expand Down Expand Up @@ -317,7 +329,7 @@ export async function configureAwsProfiles(options: {
let configModified: boolean | undefined;
let credentialsModified: boolean | undefined;

const configNeedsOverride = checkIfConfigNeedsOverride(configSection);
const configNeedsOverride = await checkIfConfigNeedsOverride(configSection);
const credentialsNeedsOverride =
checkIfCredentialsNeedsOverride(credentialsSection);

Expand Down
Loading