This commit is contained in:
artrejo
2022-01-20 18:02:41 -08:00
parent 1203427537
commit 0ffebc14ca
6 changed files with 121 additions and 71 deletions

View File

@@ -1,5 +1,18 @@
import { JunoEndpoints } from "Common/Constants";
import { allowedAadEndpoints, allowedArcadiaEndpoints, allowedArcadiaLivyDnsZones, allowedArmEndpoints, allowedBackendEndpoints, allowedEmulatorEndpoints, allowedGraphEndpoints, allowedHostedExplorerEndpoints, allowedJunoEndpoints, allowedMongoBackendEndpoints, allowedMsalRedirectEndpoints, validateEndpoint } from "Utils/EndpointValidation";
import {
allowedAadEndpoints,
allowedArcadiaEndpoints,
allowedArcadiaLivyDnsZones,
allowedArmEndpoints,
allowedBackendEndpoints,
allowedEmulatorEndpoints,
allowedGraphEndpoints,
allowedHostedExplorerEndpoints,
allowedJunoEndpoints,
allowedMongoBackendEndpoints,
allowedMsalRedirectEndpoints,
validateEndpoint,
} from "Utils/EndpointValidation";
export enum Platform {
Portal = "Portal",
@@ -84,47 +97,102 @@ export function updateConfigContext(newContext: Partial<ConfigContext>): void {
return;
}
if (!validateEndpoint(newContext.ARM_ENDPOINT, allowedArmEndpoints.map(endpoint => endpoint))) {
if (
!validateEndpoint(
newContext.ARM_ENDPOINT,
allowedArmEndpoints.map((endpoint) => endpoint)
)
) {
delete newContext.ARM_ENDPOINT;
}
if (!validateEndpoint(newContext.AAD_ENDPOINT, allowedAadEndpoints.map(endpoint => endpoint))) {
if (
!validateEndpoint(
newContext.AAD_ENDPOINT,
allowedAadEndpoints.map((endpoint) => endpoint)
)
) {
delete newContext.AAD_ENDPOINT;
}
if (!validateEndpoint(newContext.EMULATOR_ENDPOINT, allowedEmulatorEndpoints.map(endpoint => endpoint))) {
if (
!validateEndpoint(
newContext.EMULATOR_ENDPOINT,
allowedEmulatorEndpoints.map((endpoint) => endpoint)
)
) {
delete newContext.EMULATOR_ENDPOINT;
}
if (!validateEndpoint(newContext.GRAPH_ENDPOINT, allowedGraphEndpoints.map(endpoint => endpoint))) {
if (
!validateEndpoint(
newContext.GRAPH_ENDPOINT,
allowedGraphEndpoints.map((endpoint) => endpoint)
)
) {
delete newContext.GRAPH_ENDPOINT;
}
if (!validateEndpoint(newContext.ARCADIA_ENDPOINT, allowedArcadiaEndpoints.map(endpoint => endpoint))) {
if (
!validateEndpoint(
newContext.ARCADIA_ENDPOINT,
allowedArcadiaEndpoints.map((endpoint) => endpoint)
)
) {
delete newContext.ARCADIA_ENDPOINT;
}
if (!validateEndpoint(newContext.ARCADIA_LIVY_ENDPOINT_DNS_ZONE, allowedArcadiaLivyDnsZones.map(endpoint => endpoint))) {
if (
!validateEndpoint(
newContext.ARCADIA_LIVY_ENDPOINT_DNS_ZONE,
allowedArcadiaLivyDnsZones.map((endpoint) => endpoint)
)
) {
delete newContext.ARCADIA_LIVY_ENDPOINT_DNS_ZONE;
}
if (!validateEndpoint(newContext.BACKEND_ENDPOINT, allowedBackendEndpoints.map(endpoint => endpoint))) {
if (
!validateEndpoint(
newContext.BACKEND_ENDPOINT,
allowedBackendEndpoints.map((endpoint) => endpoint)
)
) {
delete newContext.BACKEND_ENDPOINT;
}
if (!validateEndpoint(newContext.MONGO_BACKEND_ENDPOINT, allowedMongoBackendEndpoints.map(endpoint => endpoint))) {
if (
!validateEndpoint(
newContext.MONGO_BACKEND_ENDPOINT,
allowedMongoBackendEndpoints.map((endpoint) => endpoint)
)
) {
delete newContext.MONGO_BACKEND_ENDPOINT;
}
if (!validateEndpoint(newContext.JUNO_ENDPOINT, allowedJunoEndpoints.map(endpoint => endpoint))) {
if (
!validateEndpoint(
newContext.JUNO_ENDPOINT,
allowedJunoEndpoints.map((endpoint) => endpoint)
)
) {
delete newContext.JUNO_ENDPOINT;
}
if (!validateEndpoint(newContext.hostedExplorerURL, allowedHostedExplorerEndpoints.map(endpoint => endpoint))) {
if (
!validateEndpoint(
newContext.hostedExplorerURL,
allowedHostedExplorerEndpoints.map((endpoint) => endpoint)
)
) {
delete newContext.hostedExplorerURL;
}
if (!validateEndpoint(newContext.msalRedirectURI, allowedMsalRedirectEndpoints.map(endpoint => endpoint))) {
if (
!validateEndpoint(
newContext.msalRedirectURI,
allowedMsalRedirectEndpoints.map((endpoint) => endpoint)
)
) {
delete newContext.msalRedirectURI;
}
@@ -201,4 +269,3 @@ export async function initializeConfiguration(): Promise<ConfigContext> {
}
export { configContext };