@aifabrix/builder 2.33.3 → 2.33.4
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/lib/utils/env-map.js +14 -9
- package/package.json +1 -1
package/lib/utils/env-map.js
CHANGED
|
@@ -233,11 +233,15 @@ function applyLocalPortAdjustment(result, devIdNum) {
|
|
|
233
233
|
|
|
234
234
|
/**
|
|
235
235
|
* Calculate public ports for docker context
|
|
236
|
+
* Uses base ports from env-config when available so *_PUBLIC_PORT is always base + devId*100
|
|
237
|
+
* (e.g. KEYCLOAK_PUBLIC_PORT = 8082 + 600 = 8682 for dev 6, not 8080 + 600 from overrides)
|
|
238
|
+
*
|
|
236
239
|
* @function calculateDockerPublicPorts
|
|
237
|
-
* @param {Object} result - Environment variable map
|
|
240
|
+
* @param {Object} result - Environment variable map (merged base + overrides)
|
|
238
241
|
* @param {number} devIdNum - Developer ID number
|
|
242
|
+
* @param {Object} [baseVars] - Base vars from env-config (used for *_PUBLIC_PORT calculation when present)
|
|
239
243
|
*/
|
|
240
|
-
function calculateDockerPublicPorts(result, devIdNum) {
|
|
244
|
+
function calculateDockerPublicPorts(result, devIdNum, baseVars = {}) {
|
|
241
245
|
if (devIdNum <= 0) {
|
|
242
246
|
return;
|
|
243
247
|
}
|
|
@@ -245,13 +249,14 @@ function calculateDockerPublicPorts(result, devIdNum) {
|
|
|
245
249
|
// Match any variable ending with _PORT (e.g., MISO_PORT, KEYCLOAK_PORT, DB_PORT)
|
|
246
250
|
if (/_PORT$/.test(key) && !/_PUBLIC_PORT$/.test(key)) {
|
|
247
251
|
const publicPortKey = key.replace(/_PORT$/, '_PUBLIC_PORT');
|
|
248
|
-
//
|
|
249
|
-
|
|
252
|
+
// Use base port from env-config when available so PUBLIC_PORT is canonical (e.g. 8082 not 8080)
|
|
253
|
+
const basePort = baseVars[key];
|
|
254
|
+
const sourceVal = basePort !== undefined && basePort !== null ? basePort : value;
|
|
250
255
|
let portVal;
|
|
251
|
-
if (typeof
|
|
252
|
-
portVal = parseInt(
|
|
253
|
-
} else if (typeof
|
|
254
|
-
portVal =
|
|
256
|
+
if (typeof sourceVal === 'string') {
|
|
257
|
+
portVal = parseInt(sourceVal, 10);
|
|
258
|
+
} else if (typeof sourceVal === 'number') {
|
|
259
|
+
portVal = sourceVal;
|
|
255
260
|
} else {
|
|
256
261
|
continue;
|
|
257
262
|
}
|
|
@@ -289,7 +294,7 @@ async function buildEnvVarMap(context, osModule = null, developerId = null) {
|
|
|
289
294
|
applyLocalPortAdjustment(result, devIdNum);
|
|
290
295
|
} else if (context === 'docker') {
|
|
291
296
|
const devIdNum = await getDeveloperIdNumber(developerId);
|
|
292
|
-
calculateDockerPublicPorts(result, devIdNum);
|
|
297
|
+
calculateDockerPublicPorts(result, devIdNum, baseVars);
|
|
293
298
|
}
|
|
294
299
|
|
|
295
300
|
return result;
|