feat: experimental caddy support

This commit is contained in:
Andras Bacsai
2024-03-11 15:08:05 +01:00
parent 5d3de967f0
commit 34d6a12d95
18 changed files with 252 additions and 113 deletions

View File

@@ -89,6 +89,7 @@ class ByIp extends Component
'team_id' => currentTeam()->id,
'private_key_id' => $this->private_key_id,
'proxy' => [
// set default proxy type to traefik v2
"type" => ProxyTypes::TRAEFIK_V2->value,
"status" => ProxyStatus::EXITED->value,
],

View File

@@ -14,7 +14,7 @@ class DynamicConfigurationNavbar extends Component
public function delete(string $fileName)
{
$server = Server::ownedByCurrentTeam()->whereId($this->server_id)->first();
$proxy_path = get_proxy_path();
$proxy_path = $server->proxyPath();
$file = str_replace('|', '.', $fileName);
instant_remote_process(["rm -f {$proxy_path}/dynamic/{$file}"], $server);
$this->dispatch('success', 'File deleted.');

View File

@@ -17,7 +17,7 @@ class DynamicConfigurations extends Component
];
public function loadDynamicConfigurations()
{
$proxy_path = get_proxy_path();
$proxy_path = $this->server->proxyPath();
$files = instant_remote_process(["mkdir -p $proxy_path/dynamic && ls -1 {$proxy_path}/dynamic"], $this->server);
$files = collect(explode("\n", $files))->filter(fn ($file) => !empty($file));
$files = $files->map(fn ($file) => trim($file));

View File

@@ -46,7 +46,7 @@ class NewDynamicConfiguration extends Component
$this->dispatch('error', 'File name is reserved.');
return;
}
$proxy_path = get_proxy_path();
$proxy_path = $this->proxyPath();
$file = "{$proxy_path}/dynamic/{$this->fileName}";
if ($this->newFile) {
$exists = instant_remote_process(["test -f $file && echo 1 || echo 0"], $this->server);