This repository has been archived by the owner on Feb 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
middleware.config.js
executable file
·65 lines (63 loc) · 2.16 KB
/
middleware.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* eslint-disable unicorn/prefer-module */
const cookieNames = {
currencyCookieName: 'vsf-currency',
countryCookieName: 'vsf-country',
localeCookieName: 'vsf-locale',
cartCookieName: 'vsf-cart',
customerCookieName: 'vsf-customer',
storeCookieName: 'vsf-store',
messageCookieName: 'vsf-message',
};
const isCheckoutEnabled = process.env.VSF_MAGENTO_EXTERNAL_CHECKOUT_ENABLED === 'true';
module.exports = {
helmet: {
crossOriginResourcePolicy: true,
referrerPolicy: { policy: 'origin' },
frameguard: { action: 'deny' },
permittedCrossDomainPolicies: { permittedPolicies: 'none' },
contentSecurityPolicy: { useDefaults: true },
expectCt: { maxAge: 86_400 },
},
integrations: {
magento: {
location: '@vue-storefront/magento-api/server',
configuration: {
api: process.env.VSF_MAGENTO_GRAPHQL_URL,
cookies: {
...cookieNames,
},
cookiesDefaultOpts: {
httpOnly: process.env.VSF_COOKIE_HTTP_ONLY || false,
secure: process.env.VSF_COOKIE_SECURE || false,
sameSite: process.env.VSF_COOKIE_SAME_SITE || 'Strict',
path: process.env.VSF_COOKIE_PATH || '/',
},
defaultStore: 'default',
externalCheckout: {
enable: isCheckoutEnabled,
cmsUrl: process.env.VSF_MAGENTO_EXTERNAL_CHECKOUT_URL,
syncUrlPath: process.env.VSF_MAGENTO_EXTERNAL_CHECKOUT_SYNC_PATH,
stores: {
default: isCheckoutEnabled,
},
},
customApolloHttpLinkOptions: {
useGETForQueries: true,
},
magentoBaseUrl: process.env.VSF_MAGENTO_BASE_URL,
magentoApiEndpoint: process.env.VSF_MAGENTO_GRAPHQL_URL,
imageProvider: process.env.VSF_IMAGE_PROVIDER,
recaptcha: {
isEnabled: process.env.VSF_RECAPTCHA_ENABLED === 'true',
sitekey: process.env.VSF_RECAPTCHA_SITE_KEY,
secretkey: process.env.VSF_RECAPTCHA_SECRET_KEY,
version: process.env.VSF_RECAPTCHA_VERSION,
score: process.env.VSF_RECAPTCHA_MIN_SCORE,
},
customer: {
customer_create_account_confirm: true,
},
},
},
},
};