Skip to content

Commit c460e30

Browse files
Merge pull request #185 from mollie/bugfix/MOL-747
Bugfix/mol 747
2 parents 1f6c306 + 449a193 commit c460e30

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

application/custom-application-config.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ const config = {
3232
labelAllLocales: [],
3333
permissions: [PERMISSIONS.Manage],
3434
},
35-
headers: {
36-
csp: {
37-
'connect-src': ['*.euope-west1.gcp.commercetoolsr.app'],
38-
},
39-
},
4035
};
4136

4237
export default config;

application/src/constants.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
11
// Make sure to import the helper functions from the `ssr` entry point.
22
import { entryPointUriPathToPermissionKeys } from '@commercetools-frontend/application-shell/ssr';
33

4-
export const entryPointUriPath = process.env.ENTRY_POINT_URI_PATH ?? 'mollie';
4+
declare global {
5+
interface Window {
6+
app?: {
7+
[key: string]: string;
8+
entryPointUriPath: string;
9+
};
10+
}
11+
}
12+
13+
const getConfig = (processKey: string, windowKey: string) => {
14+
return typeof window === 'undefined'
15+
? process.env[processKey]
16+
: window.app?.[windowKey];
17+
};
18+
19+
export const entryPointUriPath =
20+
getConfig('ENTRY_POINT_URI_PATH', 'entryPointUriPath') ?? 'mollie';
21+
522
export const PERMISSIONS = entryPointUriPathToPermissionKeys(entryPointUriPath);
6-
export const CLOUD_IDENTIFIER = process.env.CLOUD_IDENTIFIER ?? 'gcp-eu';
7-
export const CUSTOM_APPLICATION_ID = process.env.CUSTOM_APPLICATION_ID ?? '';
23+
export const CLOUD_IDENTIFIER =
24+
getConfig('CLOUD_IDENTIFIER', 'cloudIdentifier') ?? 'gcp-eu';
25+
export const CUSTOM_APPLICATION_ID =
26+
getConfig('CUSTOM_APPLICATION_ID', 'customApplicationId') ?? '';
827
export const APPLICATION_URL =
9-
process.env.APPLICATION_URL ?? 'https://mollie.app';
28+
getConfig('APPLICATION_URL', 'applicationUrl') ?? 'https://your-app-url.com';
29+
1030
export const OBJECT_CONTAINER_NAME = 'sctm-app-methods';
1131
export const EXTENSION_KEY = 'sctm-payment-create-update-extension';
1232
export const EXTENSION_URL_PATH = '/processor';

0 commit comments

Comments
 (0)