@kb-labs/core-state-daemon 2.118.0 → 2.118.1
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.
- package/dist/bin.cjs +45 -1
- package/dist/bin.cjs.map +1 -1
- package/package.json +11 -11
package/dist/bin.cjs
CHANGED
|
@@ -72297,6 +72297,47 @@ function interpolateConfig(value, required = true, env = process.env) {
|
|
|
72297
72297
|
}
|
|
72298
72298
|
return value;
|
|
72299
72299
|
}
|
|
72300
|
+
function applyLocalNetworkOffset(value, env = process.env) {
|
|
72301
|
+
const offset = Number(env.KB_NET_OFFSET) || 0;
|
|
72302
|
+
if (offset === 0) {
|
|
72303
|
+
return value;
|
|
72304
|
+
}
|
|
72305
|
+
return shiftConfigUrls(value, offset);
|
|
72306
|
+
}
|
|
72307
|
+
function shiftConfigUrls(value, offset) {
|
|
72308
|
+
if (typeof value === "string") {
|
|
72309
|
+
return shiftLoopbackUrl(value, offset);
|
|
72310
|
+
}
|
|
72311
|
+
if (Array.isArray(value)) {
|
|
72312
|
+
return value.map((item) => shiftConfigUrls(item, offset));
|
|
72313
|
+
}
|
|
72314
|
+
if (value === null || typeof value !== "object") {
|
|
72315
|
+
return value;
|
|
72316
|
+
}
|
|
72317
|
+
const result = {};
|
|
72318
|
+
for (const [key, child] of Object.entries(value)) {
|
|
72319
|
+
result[key] = key === "serviceTransport" ? child : shiftConfigUrls(child, offset);
|
|
72320
|
+
}
|
|
72321
|
+
return result;
|
|
72322
|
+
}
|
|
72323
|
+
function shiftLoopbackUrl(value, offset) {
|
|
72324
|
+
let url;
|
|
72325
|
+
try {
|
|
72326
|
+
url = new URL(value);
|
|
72327
|
+
} catch {
|
|
72328
|
+
return value;
|
|
72329
|
+
}
|
|
72330
|
+
if (!["localhost", "127.0.0.1", "::1", "[::1]"].includes(url.hostname) || !url.port) {
|
|
72331
|
+
return value;
|
|
72332
|
+
}
|
|
72333
|
+
const port = Number(url.port);
|
|
72334
|
+
if (!Number.isInteger(port) || port <= 0) {
|
|
72335
|
+
return value;
|
|
72336
|
+
}
|
|
72337
|
+
url.port = String(port + offset);
|
|
72338
|
+
const shifted = url.toString();
|
|
72339
|
+
return /^[a-z][a-z0-9+.-]*:\/\/[^/?#]+$/i.test(value) ? shifted.replace(/\/$/, "") : shifted;
|
|
72340
|
+
}
|
|
72300
72341
|
var PLATFORM_CONFIG_PRODUCT = "platform";
|
|
72301
72342
|
var PLATFORM_CONFIG_SCHEMA = {
|
|
72302
72343
|
type: "object",
|
|
@@ -72473,7 +72514,10 @@ async function loadPlatformConfig(options = {}) {
|
|
|
72473
72514
|
);
|
|
72474
72515
|
}
|
|
72475
72516
|
const strictInterpolation = env.NODE_ENV === "production";
|
|
72476
|
-
const effective =
|
|
72517
|
+
const effective = applyLocalNetworkOffset(
|
|
72518
|
+
interpolateConfig(merged, strictInterpolation, env),
|
|
72519
|
+
env
|
|
72520
|
+
);
|
|
72477
72521
|
return {
|
|
72478
72522
|
platformConfig: effective,
|
|
72479
72523
|
rawConfig: rawProjectConfig,
|