File tree Expand file tree Collapse file tree
packages/contentstack-bulk-publish/src/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11const { 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 */
89function 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 ;
You can’t perform that action at this time.
0 commit comments