Skip to content

Commit c02d533

Browse files
committed
fix bug clobbering default recipe proxy urls when user specifies their own
1 parent e05a0a5 commit c02d533

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})
22

3+
## Bug Fixes
4+
5+
* Fixed bug causing default `proxy` settings to be clobbered by user specified ones
6+
7+
## Internal
8+
9+
* Updated DevOps to use new `lando exec`
10+
* Updated `ubuntu` test runners to `24.04`
11+
312
## v1.6.0 - [May 31, 2024](https://github.com/lando/symfony/releases/tag/v1.6.0)
413

514
* Use mysql command for MariaDB 10.3.x and below [#52](https://github.com/lando/symfony/issues/52)

builders/symfony.js

+19-5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ const getServices = options => ({
5757
},
5858
});
5959

60+
/*
61+
* Helper to get proxy config
62+
*/
63+
const getProxy = (options, proxyService = 'appserver') => {
64+
// get any intial proxy stuff for proxyService
65+
const urls = _.get(options, `_app.config.proxy.${proxyService}`, []);
66+
// add
67+
urls.push(`${options.app}.${options._app._config.domain}`);
68+
// return
69+
return {[proxyService]: _.uniq(_.compact(urls))};
70+
};
71+
6072
/*
6173
* Helper to get service config
6274
*/
@@ -262,18 +274,20 @@ module.exports = {
262274
service: 'appserver',
263275
cmd: `php /app/${options.webroot}/../bin/console`,
264276
};
277+
265278
if (_.has(options, 'cache')) options.services.cache = getCache(options.cache);
266279

267-
// Rebase on top of any default config we might already have
268-
options.defaultFiles = _.merge({}, getConfigDefaults(_.cloneDeep(options)), options.defaultFiles);
269-
options.services = _.merge({}, getServices(options), options.services);
270-
options.tooling = _.merge({}, getTooling(options), options.tooling);
271280
// Switch the proxy if needed
272281
if (!_.has(options, 'proxyService')) {
273282
if (_.startsWith(options.via, 'nginx')) options.proxyService = 'appserver_nginx';
274283
else if (_.startsWith(options.via, 'apache')) options.proxyService = 'appserver';
275284
}
276-
options.proxy = _.set(options.proxy, options.proxyService, [`${options.app}.${options._app._config.domain}`]);
285+
286+
// Rebase on top of any default config we might already have
287+
options.defaultFiles = _.merge({}, getConfigDefaults(_.cloneDeep(options)), options.defaultFiles);
288+
options.proxy = _.merge({}, getProxy(options, options.proxyService), options.proxy);
289+
options.services = _.merge({}, getServices(options), options.services);
290+
options.tooling = _.merge({}, getTooling(options), options.tooling);
277291

278292
// Send downstream
279293
super(id, options);

examples/symfony-custom/.lando.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: symfony-custom
2+
proxy:
3+
appserver_nginx:
4+
- another.symfony-custom.lndo.site
25
recipe: symfony
36
config:
47
php: '8.3'

examples/symfony-custom/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ lando mysql symfony -e quit
4444
# Should have xdebug enabled
4545
lando php -m | grep Xdebug
4646

47+
# Should have proxy urls present in lando info
48+
lando info | grep "http://symfony-custom.lndo.site"
49+
lando info | grep "http://another.symfony-custom.lndo.site"
50+
4751
# Should be using custom config files
4852
lando exec appserver -- curl -L appserver_nginx/info.php | grep memory_limit | grep 513M
4953
lando exec appserver_nginx -- cat /opt/bitnami/nginx/conf/vhosts/lando.conf | grep server_name | grep pirog

0 commit comments

Comments
 (0)