Skip to content

Commit

Permalink
Adding configurable env names
Browse files Browse the repository at this point in the history
  • Loading branch information
bandana147 committed Jul 23, 2024
1 parent bf4c12a commit 9d9944f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions libs/navigation/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ const blockConfig = {
appendType: 'appendChild',
};

const envMap = {
prod: 'https://www.adobe.com',
stage: 'https://www.stage.adobe.com/',
qa: 'https://feds--milo--adobecom.hlx.page'
}

export default async function loadBlock(configs = {}) {
let miloLibs = configs.miloLibs || 'https://www.adobe.com';
const branch = new URLSearchParams(window.location.search).get('branch');
const { locale, contentRoot, env = 'prod' } = configs;
let miloLibs = envMap[env];
const branch = new URLSearchParams(window.location.search).get('navbranch');
if (branch) {
miloLibs = `https://${branch}--milo--adobecom.hlx.page`;
}
const { locale, contentRoot } = configs;

// Relative path can't be used, as the script will run on consumer's app
const { default: bootstrapBlock } = await import(`${miloLibs}/libs/navigation/bootstrapper.js`);
Expand Down

0 comments on commit 9d9944f

Please sign in to comment.