-
Notifications
You must be signed in to change notification settings - Fork 12
/
middleware.config.js
38 lines (34 loc) · 1020 Bytes
/
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
const https = require('https');
const odooRequestIsHttps = process.env.BASE_URL?.toLowerCase()?.includes('https')
const odooBaseUrl = process.env.BACKEND_BASE_URL || process.env.BASE_URL;
const graphqlBaseUrl = `${odooBaseUrl}graphql/vsf`;
const baseDomain = process.env.SITE_URL?.replace('https://', '')?.slice(0, -1) || '';
const extendApiMethods = require('./custom-api/api');
const customQueries = require('./custom-api/customQueries');
const fetchOptions = odooRequestIsHttps ? {
agent: new https.Agent({
rejectUnauthorized: false
})
} : {};
module.exports = {
integrations: {
odoo: {
location: '@vue-storefront/odoo-api/server',
configuration: {
odooBaseUrl,
graphqlBaseUrl,
baseDomain,
redisClient: (process.env.REDIS_ENABLED === 'true'),
fetchOptions
},
extensions: (extensions) => [
...extensions,
{
name: 'odoo-extension',
extendApiMethods
}
],
customQueries
}
}
};