mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-30 01:17:01 +00:00
Resolve conflicts
This commit is contained in:
parent
2e2db3c2a9
commit
521ff39eb0
@ -453,19 +453,26 @@ function configureEmulator(): Explorer {
|
|||||||
return explorer;
|
return explorer;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchAndUpdateKeys(subscriptionId: string, resourceGroup: string, account: string) {
|
export async function fetchAndUpdateKeys(subscriptionId: string, resourceGroup: string, account: string) {
|
||||||
try {
|
|
||||||
Logger.logInfo(`Fetching keys for ${userContext.apiType} account ${account}`, "Explorer/fetchAndUpdateKeys");
|
Logger.logInfo(`Fetching keys for ${userContext.apiType} account ${account}`, "Explorer/fetchAndUpdateKeys");
|
||||||
const keys = await listKeys(subscriptionId, resourceGroup, account);
|
let keys;
|
||||||
|
try {
|
||||||
|
keys = await listKeys(subscriptionId, resourceGroup, account);
|
||||||
Logger.logInfo(`Keys fetched for ${userContext.apiType} account ${account}`, "Explorer/fetchAndUpdateKeys");
|
Logger.logInfo(`Keys fetched for ${userContext.apiType} account ${account}`, "Explorer/fetchAndUpdateKeys");
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
masterKey: keys.primaryMasterKey,
|
masterKey: keys.primaryMasterKey,
|
||||||
});
|
});
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code === "AuthorizationFailed") {
|
||||||
|
keys = await getReadOnlyKeys(subscriptionId, resourceGroup, account);
|
||||||
Logger.logInfo(
|
Logger.logInfo(
|
||||||
`User context updated with Master key for ${userContext.apiType} account ${account}`,
|
`Read only Keys fetched for ${userContext.apiType} account ${account}`,
|
||||||
"Explorer/fetchAndUpdateKeys",
|
"Explorer/fetchAndUpdateKeys",
|
||||||
);
|
);
|
||||||
} catch (error) {
|
updateUserContext({
|
||||||
|
masterKey: keys.primaryReadonlyMasterKey,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
logConsoleError(`Error occurred fetching keys for the account." ${error.message}`);
|
logConsoleError(`Error occurred fetching keys for the account." ${error.message}`);
|
||||||
Logger.logError(
|
Logger.logError(
|
||||||
`Error during fetching keys or updating user context: ${error} for ${userContext.apiType} account ${account}`,
|
`Error during fetching keys or updating user context: ${error} for ${userContext.apiType} account ${account}`,
|
||||||
@ -473,6 +480,7 @@ async function fetchAndUpdateKeys(subscriptionId: string, resourceGroup: string,
|
|||||||
);
|
);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function configurePortal(): Promise<Explorer> {
|
async function configurePortal(): Promise<Explorer> {
|
||||||
|
Loading…
Reference in New Issue
Block a user