Fix CORS issue using Mongo Shell from new origin (#1422)

* Fix CORS issue using Mongo Shell from new origin

* Add unit tests for getMongoShellOrigin and getMongoShellUrl

* Fix lint errors
This commit is contained in:
Armando Trejo Oliver
2023-04-04 18:19:18 -07:00
committed by GitHub
parent 9d2d0e4754
commit 874cec26fc
5 changed files with 315 additions and 36 deletions

View File

@@ -0,0 +1,15 @@
import { configContext } from "../../../ConfigContext";
import { userContext } from "../../../UserContext";
export function getMongoShellOrigin(): string {
if (
userContext.features.enableLegacyMongoShellV1 === true ||
userContext.features.enableLegacyMongoShellV2 === true ||
userContext.features.enableLegacyMongoShellV1Dist === true ||
userContext.features.enableLegacyMongoShellV2Dist === true
) {
return window.origin;
}
return configContext.BACKEND_ENDPOINT;
}