From a1b0f2b99c59521f2511896819e00f245c1588cc Mon Sep 17 00:00:00 2001 From: Mike Pirog Date: Thu, 5 Sep 2024 09:46:51 -0400 Subject: [PATCH] recipe related fixes --- CHANGELOG.md | 5 +++++ hooks/app-find-localhosts.js | 12 +++++++++++- tasks/exec.js | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b032448fb..f75332a65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }}) +## Bug Fixes + +* Fixed bug causing preexisting `urls` in `lando info` to be clobbered by `localhost` port discovery +* Fixed bug causing `allServices` to sometimes be unset in some recipe tasks + ## v3.22.0-beta.6 - [September 4, 2024](https://github.com/lando/core/releases/tag/v3.22.0-beta.6) * This release contains only tests and is mostly to keep version sync with the CLI diff --git a/hooks/app-find-localhosts.js b/hooks/app-find-localhosts.js index 7a4077a4a..cb4dd92be 100644 --- a/hooks/app-find-localhosts.js +++ b/hooks/app-find-localhosts.js @@ -32,5 +32,15 @@ module.exports = async (app, lando) => { getHttpsPorts(data), lando.config.bindAddress, )) - .map(data => _.find(app.info, {service: data.service}).urls = data.urls); + // add data to existing info + .map(data => { + // get info + const info = _.find(app.info, {service: data.service}); + // remove existing localhosts because they are probably stale + _.remove(info.urls, url => url.startsWith('http://localhost')); + _.remove(info.urls, url => url.startsWith('https://localhost')); + // and then reset + info.urls = _.uniq([...info.urls, ...data.urls]); + }); + ; }; diff --git a/tasks/exec.js b/tasks/exec.js index 046eab2ea..d73bf4bb0 100644 --- a/tasks/exec.js +++ b/tasks/exec.js @@ -59,7 +59,7 @@ module.exports = (lando, config = lando.appConfig) => ({ } // nice things - const aservices = app.config.allServices ?? []; + const aservices = app?.config?.allServices ?? app?.allServices ?? []; const choices = `[${color.green('choices:')} ${aservices.map(service => `"${service}"`).join(', ')}]`; // gather our options