nextemos 5.4.1 → 5.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultConfig = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Deep merge function that recursively merges objects
|
|
6
|
+
* @param target - The target object to merge into
|
|
7
|
+
* @param sources - The source objects to merge from
|
|
8
|
+
* @returns The merged object
|
|
9
|
+
*/
|
|
10
|
+
function deepMerge(target, ...sources) {
|
|
11
|
+
if (!sources.length)
|
|
12
|
+
return target;
|
|
13
|
+
const source = sources.shift();
|
|
14
|
+
if (isObject(target) && isObject(source)) {
|
|
15
|
+
for (const key in source) {
|
|
16
|
+
if (isObject(source[key])) {
|
|
17
|
+
if (!target[key])
|
|
18
|
+
Object.assign(target, { [key]: {} });
|
|
19
|
+
deepMerge(target[key], source[key]);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
Object.assign(target, { [key]: source[key] });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return deepMerge(target, ...sources);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Check if value is an object (but not null, array, or primitive)
|
|
30
|
+
*/
|
|
31
|
+
function isObject(item) {
|
|
32
|
+
return item && typeof item === 'object' && !Array.isArray(item);
|
|
33
|
+
}
|
|
4
34
|
exports.defaultConfig = {
|
|
5
35
|
API_URL: "",
|
|
6
36
|
USE_API_URL: true,
|
|
@@ -38,6 +68,7 @@ exports.defaultConfig = {
|
|
|
38
68
|
SHOPPING_CART: "shoppingcartgateway",
|
|
39
69
|
STOCK: "stock",
|
|
40
70
|
CORE: "core",
|
|
71
|
+
COUPON: "coupongateway",
|
|
41
72
|
},
|
|
42
73
|
};
|
|
43
74
|
// Try to read the config file synchronously at build time
|
|
@@ -51,7 +82,7 @@ catch (error) {
|
|
|
51
82
|
loadedConfig = exports.defaultConfig;
|
|
52
83
|
}
|
|
53
84
|
// Merge with default config to ensure all required fields exist
|
|
54
|
-
const NEXTEMOS_CONFIG =
|
|
85
|
+
const NEXTEMOS_CONFIG = deepMerge({}, exports.defaultConfig, loadedConfig);
|
|
55
86
|
if (process.env.KEYCLOAK_CLIENT_SECRET) {
|
|
56
87
|
NEXTEMOS_CONFIG.KEYCLOAK.CLIENT_SECRET = process.env.KEYCLOAK_CLIENT_SECRET;
|
|
57
88
|
}
|
|
@@ -42,7 +42,7 @@ const getConfigs_1 = __importDefault(require("../../helpers/getConfigs"));
|
|
|
42
42
|
const { K8S_NAMESPACE, K8S_SERVICE_NAMES } = getConfigs_1.default;
|
|
43
43
|
exports.CouponService = {
|
|
44
44
|
Namespace: K8S_NAMESPACE,
|
|
45
|
-
ServiceUrl: () => `http://${K8S_SERVICE_NAMES.
|
|
45
|
+
ServiceUrl: () => `http://${K8S_SERVICE_NAMES.COUPON}.${exports.CouponService.Namespace}.svc.cluster.local`,
|
|
46
46
|
Prefix: "/api/coupongateway",
|
|
47
47
|
Url: (methodName, options, language) => (0, urls_1.getUrl)({
|
|
48
48
|
serviceUrl: exports.CouponService.ServiceUrl(),
|