Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions application/custom-application-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ const config = {
labelAllLocales: [],
permissions: [PERMISSIONS.Manage],
},
headers: {
csp: {
'connect-src': ['*.euope-west1.gcp.commercetoolsr.app'],
},
},
};

export default config;
28 changes: 24 additions & 4 deletions application/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
// Make sure to import the helper functions from the `ssr` entry point.
import { entryPointUriPathToPermissionKeys } from '@commercetools-frontend/application-shell/ssr';

export const entryPointUriPath = process.env.ENTRY_POINT_URI_PATH ?? 'mollie';
declare global {
interface Window {
app?: {
[key: string]: string;
entryPointUriPath: string;
};
}
}

const getConfig = (processKey: string, windowKey: string) => {
return typeof window === 'undefined'
? process.env[processKey]
: window.app?.[windowKey];
};

export const entryPointUriPath =
getConfig('ENTRY_POINT_URI_PATH', 'entryPointUriPath') ?? 'mollie';

export const PERMISSIONS = entryPointUriPathToPermissionKeys(entryPointUriPath);
export const CLOUD_IDENTIFIER = process.env.CLOUD_IDENTIFIER ?? 'gcp-eu';
export const CUSTOM_APPLICATION_ID = process.env.CUSTOM_APPLICATION_ID ?? '';
export const CLOUD_IDENTIFIER =
getConfig('CLOUD_IDENTIFIER', 'cloudIdentifier') ?? 'gcp-eu';
export const CUSTOM_APPLICATION_ID =
getConfig('CUSTOM_APPLICATION_ID', 'customApplicationId') ?? '';
export const APPLICATION_URL =
process.env.APPLICATION_URL ?? 'https://mollie.app';
getConfig('APPLICATION_URL', 'applicationUrl') ?? 'https://your-app-url.com';

export const OBJECT_CONTAINER_NAME = 'sctm-app-methods';
export const EXTENSION_KEY = 'sctm-payment-create-update-extension';
export const EXTENSION_URL_PATH = '/processor';
Expand Down
Loading