1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-06 08:40:09 +01:00

Dnsmasq allows use of a common config folder, much like nginx and php do.

This PR changes Valet's default config process to empower this feature, which makes installation less intrusive, and easier to identify and remove valet-specific customizations.

This will make for easier troubleshooting
... and easier customizing (such as dropping in a custom logging config, additional TLDs, alternate DNS resolvers, etc)

Also removes old dnsmasq configs used by prior Valet versions
This commit is contained in:
Chris Brown
2019-11-30 18:17:57 -05:00
parent fb562977f0
commit 02ad7f44ff
3 changed files with 64 additions and 69 deletions

View File

@@ -38,18 +38,21 @@ public function test_install_installs_and_places_configuration_files_in_proper_l
$dnsMasq = resolve(StubForCreatingCustomDnsMasqConfigFiles::class);
$dnsMasq->exampleConfigPath = __DIR__.'/files/dnsmasq.conf';
$dnsMasq->configPath = __DIR__.'/output/dnsmasq.conf';
$dnsMasq->dnsmasqMasterConfigFile = __DIR__.'/output/dnsmasq.conf';
$dnsMasq->dnsmasqSystemConfDir = __DIR__.'/output/dnsmasq.d';
$dnsMasq->resolverPath = __DIR__.'/output/resolver';
file_put_contents($dnsMasq->dnsmasqMasterConfigFile, file_get_contents(__DIR__.'/files/dnsmasq.conf'));
$dnsMasq->install('test');
$this->assertSame('nameserver 127.0.0.1'.PHP_EOL, file_get_contents(__DIR__.'/output/resolver/test'));
$this->assertSame('address=/.test/127.0.0.1'.PHP_EOL.'listen-address=127.0.0.1'.PHP_EOL, file_get_contents(__DIR__.'/output/custom-dnsmasq.conf'));
$this->assertSame('address=/.test/127.0.0.1'.PHP_EOL.'listen-address=127.0.0.1'.PHP_EOL, file_get_contents(__DIR__.'/output/tld-test.conf'));
$this->assertSame('test-contents
conf-file='.__DIR__.'/output/custom-dnsmasq.conf
', file_get_contents(__DIR__.'/output/dnsmasq.conf'));
' . PHP_EOL . 'conf-dir=/usr/local/etc/dnsmasq.d/,*.conf' . PHP_EOL,
file_get_contents($dnsMasq->dnsmasqMasterConfigFile)
);
}
@@ -66,8 +69,8 @@ public function test_update_tld_removes_old_resolver_and_reinstalls()
class StubForCreatingCustomDnsMasqConfigFiles extends DnsMasq
{
public function customConfigPath()
public function dnsmasqUserConfigDir()
{
return __DIR__.'/output/custom-dnsmasq.conf';
return __DIR__.'/output/';
}
}