Skip to content

Commit eefcb36

Browse files
sunil-lakshmanharshitha-cstk
authored andcommitted
Fixed PR comments
1 parent e2a6822 commit eefcb36

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

packages/contentstack-bulk-publish/src/util/bulk-publish-utils.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
const { regions } = require('@contentstack/cli-config/lib/utils/region-handler');
2+
const { configHandler } = require('@contentstack/cli-utilities');
23

34
/**
45
* Get the appropriate app URL based on the host
56
* @param {string} host - The host URL
67
* @returns {string} The app URL
78
*/
89
function getAppUrlFromHost(host) {
9-
// Handle development and staging environments
10+
// Get the current region from configHandler
11+
const currentRegion = configHandler.get('region');
12+
13+
// If we have a configured region, use its uiHost
14+
if (currentRegion && currentRegion.uiHost) {
15+
return currentRegion.uiHost;
16+
}
17+
18+
// Handle development and staging environments (fallback for when region is not configured)
1019
if (host.includes('stag')) {
1120
return 'https://stag-app.csnonprod.com';
1221
}
@@ -20,7 +29,7 @@ function getAppUrlFromHost(host) {
2029
return 'https://dev-app.csnonprod.com';
2130
}
2231

23-
// Find matching region based on host
32+
// Find matching region based on host (fallback)
2433
for (const regionConfig of Object.values(regions)) {
2534
if (host.includes(regionConfig.cma.replace('https://', ''))) {
2635
return regionConfig.uiHost;

0 commit comments

Comments
 (0)