From 5cbfa85a3dcd5c10fd9d232f8ee72fcf79567f8a Mon Sep 17 00:00:00 2001 From: Mike Pirog Date: Fri, 6 Sep 2024 08:30:36 -0400 Subject: [PATCH] fix bug clobbering default recipe proxy urls when user ones are specified --- CHANGELOG.md | 20 +++++++++++++++++--- examples/backdrop-custom/.lando.yml | 3 +++ examples/backdrop-custom/README.md | 4 ++++ utils/get-proxy.js | 10 ++++++++-- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a90899..fc25f97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,27 @@ +## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }}) + +## Bug Fixes + +* Fixed bug causing default `proxy` settings to be clobbered by user specified ones + +## Internal + +* Updated DevOps to use new `lando exec` +* Updated `ubuntu` test runners to `24.04` + ## v1.4.0 - [May 1, 2024](https://github.com/lando/backdrop/releases/tag/v1.4.0) - * Fixed spelling errors. [#48](https://github.com/lando/backdrop/issues/48) - * Updated mariadb plugin. [#51](https://github.com/lando/mariadb/issues/51) + +* Fixed spelling errors. [#48](https://github.com/lando/backdrop/issues/48) +* Updated mariadb plugin. [#51](https://github.com/lando/mariadb/issues/51) ## v1.3.0 - [March 8, 2024](https://github.com/lando/backdrop/releases/tag/v1.3.0) - * Updated to latest database services. + +* Updated to latest database services. ## v1.2.1 - [March 4, 2024](https://github.com/lando/backdrop/releases/tag/v1.2.1) ### Fixes + * Improved `database` selection for purposes of `config` loading, fixes some `database` bootup issues when the `database` type is overridden downstream ## v1.2.0 - [February 24, 2024](https://github.com/lando/backdrop/releases/tag/v1.2.0) diff --git a/examples/backdrop-custom/.lando.yml b/examples/backdrop-custom/.lando.yml index 2c80e5b..f9e3b8d 100644 --- a/examples/backdrop-custom/.lando.yml +++ b/examples/backdrop-custom/.lando.yml @@ -1,4 +1,7 @@ name: backdrop-custom +proxy: + appserver_nginx: + - hollaback.backdrop.lndo.site recipe: backdrop config: php: '8.3' diff --git a/examples/backdrop-custom/README.md b/examples/backdrop-custom/README.md index 71b48bd..52b528c 100644 --- a/examples/backdrop-custom/README.md +++ b/examples/backdrop-custom/README.md @@ -46,6 +46,10 @@ lando php -m | grep Xdebug # Should have bee 1.x-1.x lando bee version | grep "Bee for Backdrop CMS" | grep "1.x-1.x" +# Should have proxy urls present in lando info +lando info | grep "backdrop-custom.lndo.site" +lando info | grep "hollaback.backdrop.lndo.site" + # Should be using custom config files lando ssh -s appserver -c "curl -L appserver_nginx/info.php" | grep memory_limit | grep 513M lando ssh -s appserver_nginx -c "cat /opt/bitnami/nginx/conf/vhosts/lando.conf" | grep server_name | grep pirog diff --git a/utils/get-proxy.js b/utils/get-proxy.js index 65e9178..3b8cd77 100644 --- a/utils/get-proxy.js +++ b/utils/get-proxy.js @@ -8,6 +8,12 @@ module.exports = options => { if (!_.has(options, 'proxyService') && options.webserver.type === 'nginx') options.proxyService = 'appserver_nginx'; else if (!_.has(options, 'proxyService') && options.webserver.type === 'apache') options.proxyService = 'appserver'; - // set and return - return _.set({}, options.proxyService, [`${options.app}.${options._app._config.domain}`]); + // get any intial proxy stuff for proxyService + const urls = _.get(options, `_app.config.proxy.${options.proxyService}`, []); + // add + urls.push(`${options.app}.${options._app._config.domain}`); + // set + options.proxy[options.proxyService] = _.uniq(_.compact(urls)); + // return + return options.proxy; };