mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-06-05 15:12:04 +01:00
Resolve conflicts
This commit is contained in:
parent
2e2db3c2a9
commit
521ff39eb0
@ -453,25 +453,33 @@ 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) {
|
||||||
|
Logger.logInfo(`Fetching keys for ${userContext.apiType} account ${account}`, "Explorer/fetchAndUpdateKeys");
|
||||||
|
let keys;
|
||||||
try {
|
try {
|
||||||
Logger.logInfo(`Fetching keys for ${userContext.apiType} account ${account}`, "Explorer/fetchAndUpdateKeys");
|
keys = await listKeys(subscriptionId, resourceGroup, account);
|
||||||
const 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,
|
||||||
});
|
});
|
||||||
Logger.logInfo(
|
|
||||||
`User context updated with Master key for ${userContext.apiType} account ${account}`,
|
|
||||||
"Explorer/fetchAndUpdateKeys",
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logConsoleError(`Error occurred fetching keys for the account." ${error.message}`);
|
if (error.code === "AuthorizationFailed") {
|
||||||
Logger.logError(
|
keys = await getReadOnlyKeys(subscriptionId, resourceGroup, account);
|
||||||
`Error during fetching keys or updating user context: ${error} for ${userContext.apiType} account ${account}`,
|
Logger.logInfo(
|
||||||
"Explorer/fetchAndUpdateKeys",
|
`Read only Keys fetched for ${userContext.apiType} account ${account}`,
|
||||||
);
|
"Explorer/fetchAndUpdateKeys",
|
||||||
throw error;
|
);
|
||||||
|
updateUserContext({
|
||||||
|
masterKey: keys.primaryReadonlyMasterKey,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
logConsoleError(`Error occurred fetching keys for the account." ${error.message}`);
|
||||||
|
Logger.logError(
|
||||||
|
`Error during fetching keys or updating user context: ${error} for ${userContext.apiType} account ${account}`,
|
||||||
|
"Explorer/fetchAndUpdateKeys",
|
||||||
|
);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user