Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #183 from adobe/issue-182
Browse files Browse the repository at this point in the history
fix(extension): project config not applied
  • Loading branch information
rofe authored Dec 10, 2021
2 parents 779bd07 + b05d342 commit 26e520b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/extension/manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"manifest_version": 2,
"name": "__MSG_title__",
"version": "0.9.8",
"version": "0.9.9",
"author": "Adobe",
"homepage_url": "https://www.hlx.live/tools/sidekick/",
"update_url": "https://www.hlx.live/tools/sidekick/extension.xml",
"default_locale": "en",
"options_page": "options.html",
"description": "__MSG_description__",
Expand Down
18 changes: 13 additions & 5 deletions src/extension/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,12 @@ async function getProjectConfig(owner, repo, ref) {
const res = await fetch(configJS);
if (res.ok) {
const js = await res.text();
const [, host] = /host: ?["']{1}(.*)['"]{1}/.exec(js) || [];
if (host) {
cfg.host = host;
}
['project', 'host', 'outerHost'].forEach((prop) => {
const [, value] = new RegExp(`${prop}: ?["']{1}(.*)['"]{1}`).exec(js) || [];
if (value) {
cfg[prop] = value;
}
});
}
return cfg;
}
Expand All @@ -186,15 +188,21 @@ export async function assembleConfig({
hlx3,
project,
host,
outerHost,
devMode,
}) {
const { owner, repo, ref } = getGitHubSettings(giturl);
const projectConfig = await getProjectConfig(owner, repo, ref);
// allow local project config overrides
project = project || projectConfig.project;
host = host || projectConfig.host;
outerHost = outerHost || projectConfig.outerHost;

return {
id: `${owner}/${repo}/${ref}`,
...projectConfig,
project,
host,
outerHost,
hlx3,
devMode,
giturl,
Expand Down

0 comments on commit 26e520b

Please sign in to comment.