Skip to content

Commit

Permalink
Update global-functions.js
Browse files Browse the repository at this point in the history
Update getEnvironment and getEnvironmentDomain functions
  • Loading branch information
pankajkumar-bounteous authored Dec 5, 2024
1 parent c150ad0 commit 344d4fe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/global-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ function getEnvironmentDomain(env) {
case 'pricefx-eds-prod':
return 'publish-p131512-e1282666.adobeaemcloud.com';
case 'pricefx.com':
case 'www.pricefx.com':
case 'preview.pricefx.com':
return ''; // Return empty string for relative URL
return 'publish-p131512-e1282666.adobeaemcloud.com';

Check warning on line 68 in scripts/global-functions.js

View workflow job for this annotation

GitHub Actions / build

Delete `·`
default:
return '';
}
Expand Down Expand Up @@ -120,11 +121,11 @@ function getEnvironment() {
};

const keys = Object.keys(envMap);
const result = keys.find((key) => hostname.includes(`--${key}--`) || hostname.includes(key));
const result = keys.find((key) => hostname.includes(`--${key}--`));

// Check if the URL is external
if (!result) {
return null; // If the environment is not found in the hostname, return null
return hostname.includes('pricefx')? hostname : 'pricefx.com'; // If the environment is not found in the hostname, return hostname

Check warning on line 128 in scripts/global-functions.js

View workflow job for this annotation

GitHub Actions / build

Insert `·`
}

return result ? envMap[result] : 'pricefx.com'; // Default to live
Expand Down

0 comments on commit 344d4fe

Please sign in to comment.