refactor: Update ProxyTypes enum values to use TRAEFIK instead of TRAEFIK_V2

This commit is contained in:
Andras Bacsai
2024-08-07 17:52:51 +02:00
parent 13e8d3c17c
commit 59702c6dbc
11 changed files with 28 additions and 22 deletions

View File

@@ -104,7 +104,7 @@ class ByIp extends Component
'private_key_id' => $this->private_key_id,
'proxy' => [
// set default proxy type to traefik v2
'type' => ProxyTypes::TRAEFIK_V2->value,
'type' => ProxyTypes::TRAEFIK->value,
'status' => ProxyStatus::EXITED->value,
],
];

View File

@@ -2,6 +2,7 @@
namespace App\Livewire\Server\Proxy;
use App\Enums\ProxyTypes;
use App\Models\Server;
use Livewire\Component;
use Symfony\Component\Yaml\Yaml;
@@ -45,7 +46,7 @@ class NewDynamicConfiguration extends Component
return redirect()->route('server.index');
}
$proxy_type = $this->server->proxyType();
if ($proxy_type === 'TRAEFIK_V2') {
if ($proxy_type === ProxyTypes::TRAEFIK->value) {
if (! str($this->fileName)->endsWith('.yaml') && ! str($this->fileName)->endsWith('.yml')) {
$this->fileName = "{$this->fileName}.yaml";
}
@@ -69,7 +70,7 @@ class NewDynamicConfiguration extends Component
return;
}
}
if ($proxy_type === 'TRAEFIK_V2') {
if ($proxy_type === ProxyTypes::TRAEFIK->value) {
$yaml = Yaml::parse($this->value);
$yaml = Yaml::dump($yaml, 10, 2);
$this->value = $yaml;