-
Notifications
You must be signed in to change notification settings - Fork 0
/
middleware.config.js
executable file
·79 lines (76 loc) · 2.53 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
require("dotenv").config();
import customCartQuery from "./customQueries/cart";
import customCustomerCartQuery from "./customQueries/customerCart";
/* 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 || "lax",
path: process.env.VSF_COOKIE_PATH || "/",
},
defaultStore: "en",
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.NUXT_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,
},
},
customQueries: {
cart: (context) => ({
...context,
query: customCartQuery,
}),
customerCart: (context) => ({
...context,
query: customCustomerCartQuery,
}),
},
},
},
};