mirror of
https://github.com/laravel/valet.git
synced 2026-02-07 01:00:09 +01:00
Rewrite TLS Caddy files on install
Porting this from master branch for now, makes it a lot easier for people to go from master to 1.1.* since the master branch has a different Caddyfile structure. Since Caddy 0.9.* still has the X-Accel-Redirect issue re: Content-Type, we can't tag on master yet, so this will help people get back to a tagged release without having to manually fix a bunch of Caddyfiles.
This commit is contained in:
@@ -6,6 +6,8 @@ class Caddy
|
||||
{
|
||||
var $cli;
|
||||
var $files;
|
||||
var $configuration;
|
||||
var $site;
|
||||
var $daemonPath = '/Library/LaunchDaemons/com.laravel.valetServer.plist';
|
||||
|
||||
/**
|
||||
@@ -14,10 +16,12 @@ class Caddy
|
||||
* @param CommandLine $cli
|
||||
* @param Filesystem $files
|
||||
*/
|
||||
function __construct(CommandLine $cli, Filesystem $files)
|
||||
function __construct(CommandLine $cli, Filesystem $files, Configuration $configuration, Site $site)
|
||||
{
|
||||
$this->cli = $cli;
|
||||
$this->files = $files;
|
||||
$this->configuration = $configuration;
|
||||
$this->site = $site;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,6 +65,21 @@ function installCaddyDirectory()
|
||||
}
|
||||
|
||||
$this->files->putAsUser($caddyDirectory.'/.keep', "\n");
|
||||
|
||||
$this->rewriteSecureCaddyFiles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate fresh Caddyfiles for existing secure sites.
|
||||
*
|
||||
* This simplifies upgrading when the Caddyfile structure changes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function rewriteSecureCaddyFiles()
|
||||
{
|
||||
$domain = $this->configuration->read()['domain'];
|
||||
$this->site->resecureForNewDomain($domain, $domain);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user