feat: dynamic configuration for caddy

This commit is contained in:
Andras Bacsai
2024-03-11 17:31:28 +01:00
parent 9bdad6bb67
commit 1490828069
6 changed files with 46 additions and 19 deletions

View File

@@ -15,8 +15,16 @@ class DynamicConfigurationNavbar extends Component
{
$server = Server::ownedByCurrentTeam()->whereId($this->server_id)->first();
$proxy_path = $server->proxyPath();
$proxy_type = $server->proxyType();
$file = str_replace('|', '.', $fileName);
if ($proxy_type === 'CADDY' && $file === "Caddyfile") {
$this->dispatch('error', 'Cannot delete Caddyfile.');
return;
}
instant_remote_process(["rm -f {$proxy_path}/dynamic/{$file}"], $server);
if ($proxy_type === 'CADDY') {
$server->reloadCaddy();
}
$this->dispatch('success', 'File deleted.');
$this->dispatch('loadDynamicConfigurations');
$this->dispatch('refresh');