-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregions.js
More file actions
33 lines (31 loc) · 1.16 KB
/
Copy pathregions.js
File metadata and controls
33 lines (31 loc) · 1.16 KB
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
/**
* Region-specific API hosts, selected via REGION in .env.
*
* lyticsApiRoot — direct Lytics API (script.js, segment.js, flow-experience.js)
* csGatewayRoot — Contentstack proxy gateway (new-script.js, segment-flow.js)
*/
const REGIONS = {
NA: {
lyticsApiRoot: "https://api.lytics.io",
csGatewayRoot: "https://lytics-api.contentstack.com/api-gateway",
},
EU: {
lyticsApiRoot: "https://eu-api.lytics.io",
csGatewayRoot: "https://eu-lytics-api.contentstack.com/api-gateway",
},
// No known Azure-NA-specific host for the direct Lytics API — falls back
// to the standard NA root. Update if that changes.
"AZURE-NA": {
lyticsApiRoot: "https://api.lytics.io",
csGatewayRoot: "https://azure-na-lytics-api.contentstack.com/api-gateway",
},
};
function getRegionConfig() {
const region = (process.env.REGION || "NA").toUpperCase();
const config = REGIONS[region];
if (!config) {
throw new Error(`Unknown REGION "${region}" in .env. Valid options: ${Object.keys(REGIONS).join(", ")}`);
}
return { region, ...config };
}
module.exports = { REGIONS, getRegionConfig };