mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 07:34:03 +00:00
Add vhost_is_written test
This commit is contained in:
parent
094dc924e4
commit
2a33d0ec85
7 changed files with 105 additions and 7 deletions
|
|
@ -2,8 +2,37 @@
|
|||
|
||||
namespace Stancl\Tenancy\ServerConfigManagers;
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
use Stancl\Tenancy\Interfaces\ServerConfigManager;
|
||||
|
||||
class NginxConfigManager implements ServerConfigManager
|
||||
{
|
||||
public function addVhost(string $domain, string $file): bool
|
||||
{
|
||||
$f = fopen($file, 'a');
|
||||
fwrite($f, $this->getVhostText($domain));
|
||||
fclose($f);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getVhostText(string $domain)
|
||||
{
|
||||
return str_replace('%host%', $domain, config('tenancy.server.nginx.vhost'));
|
||||
}
|
||||
|
||||
public function deployCertificate(string $domain): bool
|
||||
{
|
||||
$process = new Process(array_merge([
|
||||
config('tenancy.server.certbot_path'),
|
||||
'-n',
|
||||
'--nginx',
|
||||
'--agree-tos',
|
||||
'-d', $domain,
|
||||
'--preferred-challenges', 'http',
|
||||
], config('tenancy.server.nginx.extra_certbot_args')));
|
||||
|
||||
$process->run();
|
||||
|
||||
return $process->isSuccessful();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue