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

Write a Caddy directory for loading additional configuration files.

This commit is contained in:
Taylor Otwell
2016-05-07 12:06:48 -05:00
parent 6fe0cd71fc
commit c9382d2380
2 changed files with 16 additions and 1 deletions

View File

@@ -11,10 +11,23 @@ class Caddy
*/ */
public static function install() public static function install()
{ {
copy(__DIR__.'/../stubs/Caddyfile', VALET_HOME_PATH.'/Caddyfile'); file_put_contents(
VALET_HOME_PATH.'/Caddyfile',
str_replace('USER', $_SERVER['SUDO_USER'], file_get_contents(__DIR__.'/../stubs/Caddyfile'))
);
chown(VALET_HOME_PATH.'/Caddyfile', $_SERVER['SUDO_USER']); chown(VALET_HOME_PATH.'/Caddyfile', $_SERVER['SUDO_USER']);
if (! is_dir($caddyDirectory = VALET_HOME_PATH.'/Caddy')) {
mkdir($caddyDirectory, 0755);
chown($caddyDirectory, $_SERVER['SUDO_USER']);
touch($caddyDirectory.'/.keep');
chown($caddyDirectory.'/.keep', $_SERVER['SUDO_USER']);
}
$contents = str_replace( $contents = str_replace(
'VALET_PATH', realpath(__DIR__.'/../'), file_get_contents(__DIR__.'/../stubs/daemon.plist') 'VALET_PATH', realpath(__DIR__.'/../'), file_get_contents(__DIR__.'/../stubs/daemon.plist')
); );

View File

@@ -1,3 +1,5 @@
import /Users/USER/.valet/Caddy/*
:80 { :80 {
fastcgi / 127.0.0.1:9000 php { fastcgi / 127.0.0.1:9000 php {
index server.php index server.php