Skip to content

Commit

Permalink
Merge branch 'main' into task/WG-427-add-file-modal-to-point-cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
rstijerina authored Feb 11, 2025
2 parents 7eae635 + c24280c commit 2dc7aa8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
23 changes: 20 additions & 3 deletions react/src/hooks/environment/getLocalAppConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
AppConfiguration,
MapillaryConfiguration,
DesignSafePortalEnvironment,
GeoapiBackendEnvironment,
} from '@hazmapper/types';

/**
Expand All @@ -16,12 +17,27 @@ export const getLocalAppConfiguration = (
basePath: string,
mapillaryConfig: MapillaryConfiguration
): AppConfiguration => {
const designSafePortal =
localDevelopmentConfiguration.designSafePortal ??
DesignSafePortalEnvironment.PPRD;

// Check for possible mismatches in Geoapi production or Geoapi staging, as these deployed environments correspond to DS prod and pprd, respectively.
if (
(localDevelopmentConfiguration.geoapiBackend ===
GeoapiBackendEnvironment.Production &&
designSafePortal !== DesignSafePortalEnvironment.Production) ||
(localDevelopmentConfiguration.geoapiBackend ===
GeoapiBackendEnvironment.Staging &&
designSafePortal !== DesignSafePortalEnvironment.PPRD)
) {
const msg = `Mismatch detected: geoapiBackend is '${localDevelopmentConfiguration.geoapiBackend}', but designSafePortal is '${designSafePortal}'.`;
throw new Error(msg);
}

const appConfig: AppConfiguration = {
basePath: basePath,
geoapiUrl: getGeoapiUrl(localDevelopmentConfiguration.geoapiBackend),
designsafePortalUrl: getDesignsafePortalUrl(
DesignSafePortalEnvironment.PPRD
),
designsafePortalUrl: getDesignsafePortalUrl(designSafePortal),
tapisUrl: 'https://designsafe.tapis.io',
mapillary: mapillaryConfig,
taggitUrl: origin + '/taggit-staging',
Expand All @@ -31,5 +47,6 @@ export const getLocalAppConfiguration = (
'MLY|5156692464392931|6be48c9f4074f4d486e0c42a012b349f';
appConfig.mapillary.clientToken =
'MLY|5156692464392931|4f1118aa1b06f051a44217cb56bedf79';

return appConfig;
};
9 changes: 7 additions & 2 deletions react/src/secret_local.example.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { GeoapiBackendEnvironment, LocalAppConfiguration } from './types';
import {
DesignSafePortalEnvironment,
GeoapiBackendEnvironment,
LocalAppConfiguration,
} from './types';

export const localDevelopmentConfiguration: LocalAppConfiguration = {
geoapiBackend: GeoapiBackendEnvironment.Production,
geoapiBackend: GeoapiBackendEnvironment.Staging,
designSafePortal: DesignSafePortalEnvironment.PPRD,
};
3 changes: 3 additions & 0 deletions react/src/types/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export enum ApiService {
export interface LocalAppConfiguration {
/* The type of backend environment (production, staging, development, or local) */
geoapiBackend: GeoapiBackendEnvironment;

/** Type of GeoAPI service. Defaults to PPRD if not provided */
designSafePortal?: DesignSafePortalEnvironment;
}

/**
Expand Down

0 comments on commit 2dc7aa8

Please sign in to comment.