Initial attempt at updating the user context with a regional endpoint. Successful.

This commit is contained in:
Craig Boger (from Dev Box) 2024-01-26 16:03:10 -08:00
parent c5fcca2dc1
commit 60a76a69f6
3 changed files with 35 additions and 1 deletions

View File

@ -172,6 +172,26 @@ export function client(): Cosmos.CosmosClient {
},
};
// Account details from userContext.
console.log(`userContext details: ${JSON.stringify(userContext)}`);
console.log(`userContext.databaseaccount details: ${JSON.stringify(userContext.databaseAccount)}`);
console.log(
`userContext?.databaseAccount?.properties?.documentEndpoint details: ${JSON.stringify(
userContext?.databaseAccount?.properties?.documentEndpoint,
)}`,
);
console.log(`userContext?.endpoint details: ${JSON.stringify(userContext?.endpoint)}`);
console.log(
`userContext?.databaseAccount?.properties?.readLocations details: ${JSON.stringify(
userContext?.databaseAccount?.properties?.readLocations,
)}`,
);
console.log(
`userContext?.databaseAccount?.properties?.writeLocations details: ${JSON.stringify(
userContext?.databaseAccount?.properties?.writeLocations,
)}`,
);
if (configContext.PROXY_PATH !== undefined) {
(options as any).plugins = [{ on: "request", plugin: requestPlugin }];
}

View File

@ -168,6 +168,8 @@ export function createStaticCommandBarButtons(
}
}
// Attempting to add region selection button here.
return buttons;
}

View File

@ -280,13 +280,25 @@ async function configureHostedWithAAD(config: AAD): Promise<Explorer> {
throw new Error(`List keys failed: ${e.message}`);
}
}
// Updating database account endpoint for testing purposes.
const updatedDatabaseAccount = {
...config.databaseAccount,
properties: {
...config.databaseAccount.properties,
documentEndpoint: "https://test-craig-nosql-periodic.documents.azure.com:443/",
},
};
updateUserContext({
subscriptionId,
resourceGroup,
aadToken,
databaseAccount: config.databaseAccount,
databaseAccount: updatedDatabaseAccount,
masterKey: keys.primaryMasterKey,
});
console.log(`INITIALIZED ENDPOINT: ${JSON.stringify(userContext.databaseAccount.properties.documentEndpoint)}`);
userContext.databaseAccount.properties.readLocations.forEach((readLocation) => {
console.log(`REGIONAL READ ENDPOINT(S): ${JSON.stringify(readLocation)}`);
});
const explorer = new Explorer();
return explorer;
}