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

@@ -118,17 +118,30 @@ class Server extends BaseModel
}
}
}
public function proxyPath() {
$base_path = config('coolify.base_config_path');
$proxyType = $this->proxyType();
$proxy_path = "$base_path/proxy";
if ($proxyType === ProxyTypes::TRAEFIK_V2->value) {
$proxy_path = $proxy_path;
} else if ($proxyType === ProxyTypes::CADDY->value) {
$proxy_path = $proxy_path . '/caddy';
} else if ($proxyType === ProxyTypes::NGINX->value) {
$proxy_path = $proxy_path . '/nginx';
}
return $proxy_path;
}
public function proxyType()
{
$proxyType = $this->proxy->get('type');
if ($proxyType === ProxyTypes::NONE->value) {
return $proxyType;
}
if (is_null($proxyType)) {
$this->proxy->type = ProxyTypes::TRAEFIK_V2->value;
$this->proxy->status = ProxyStatus::EXITED->value;
$this->save();
}
// if (is_null($proxyType)) {
// $this->proxy->type = ProxyTypes::TRAEFIK_V2->value;
// $this->proxy->status = ProxyStatus::EXITED->value;
// $this->save();
// }
return $this->proxy->get('type');
}
public function scopeWithProxy(): Builder