Skip to content

Commit 8dd8b2f

Browse files
committed
Fix xdebug env var precedence issues
- Remove XDEBUG_MODE env var to allow INI-based toggle to work - Update xdebugConfig() to use user's normalized config values instead of hardcoded values - Fixes client_host and other settings being overridden by XDEBUG_CONFIG env var
1 parent 4af9cdf commit 8dd8b2f

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

builders/php.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ const nginxConfig = options => ({
5151
version: options.via.split(':')[1],
5252
});
5353

54-
const xdebugConfig = phpSemver => {
54+
const xdebugConfig = (phpSemver, normalizedConfig) => {
5555
const config = [
56-
'client_host=host.lando.internal',
56+
`client_host=${normalizedConfig.client_host}`,
5757
'discover_client_host=1',
58-
'log=/tmp/xdebug.log',
58+
`log=${normalizedConfig.log === false ? '' : normalizedConfig.log}`,
5959
];
6060

6161
if (phpSemver && semver.lt(phpSemver, '7.2.0')) {
62-
config.push('remote_enable=true', 'remote_host=host.lando.internal');
62+
config.push('remote_enable=true', `remote_host=${normalizedConfig.client_host}`);
6363
}
6464

6565
return config.join(' ');
@@ -311,8 +311,7 @@ const phpBuilder = {
311311
environment: _.merge({}, options.environment, {
312312
PATH: options.path.join(':'),
313313
LANDO_WEBROOT: `/app/${options.webroot}`,
314-
XDEBUG_CONFIG: xdebugConfig(phpSemver),
315-
XDEBUG_MODE: options._xdebugConfig.mode,
314+
XDEBUG_CONFIG: xdebugConfig(phpSemver, options._xdebugConfig),
316315
}),
317316
networks: (_.startsWith(options.via, 'nginx')) ? {default: {aliases: ['fpm']}} : {default: {}},
318317
ports: (_.startsWith(options.via, 'apache') && options.version !== 'custom') ? ['80'] : [],

0 commit comments

Comments
 (0)