diff --git a/src/Caddy.php b/src/Caddy.php index 05ca4f1..9da5b82 100644 --- a/src/Caddy.php +++ b/src/Caddy.php @@ -44,7 +44,7 @@ function installCaddyFile() { $this->files->putAsUser( VALET_HOME_PATH.'/Caddyfile', - str_replace('USER', user(), $this->files->get(__DIR__.'/../stubs/Caddyfile')) + str_replace('VALET_HOME_PATH', VALET_HOME_PATH, $this->files->get(__DIR__.'/../stubs/Caddyfile')) ); } diff --git a/stubs/Caddyfile b/stubs/Caddyfile index 8177701..f628c85 100644 --- a/stubs/Caddyfile +++ b/stubs/Caddyfile @@ -1,4 +1,4 @@ -import /Users/USER/.valet/Caddy/* +import VALET_HOME_PATH/.valet/Caddy/* :80 { fastcgi / 127.0.0.1:9000 php { diff --git a/tests/CaddyTest.php b/tests/CaddyTest.php index 4253ad9..4196626 100644 --- a/tests/CaddyTest.php +++ b/tests/CaddyTest.php @@ -27,7 +27,7 @@ public function test_install_caddy_file_places_stub_in_valet_home_directory() $files->shouldReceive('putAsUser')->andReturnUsing(function ($path, $contents) { $this->assertEquals(VALET_HOME_PATH.'/Caddyfile', $path); - $this->assertTrue(strpos($contents, 'import /Users/'.user().'/.valet/Caddy/*') !== false); + $this->assertTrue(strpos($contents, 'import '.VALET_HOME_PATH.'/.valet/Caddy/*') !== false); }); swap(Filesystem::class, $files);