CluPilotCloud/app/Services/Traefik/FakeTraefikWriter.php

31 lines
765 B
PHP

<?php
namespace App\Services\Traefik;
class FakeTraefikWriter implements TraefikWriter
{
/** @var array<string, string> subdomain => backend */
public array $routes = [];
/** @var array<string, string> subdomain => traffic host */
public array $hosts = [];
public bool $certReady = true;
public function write(string $trafficHost, string $subdomain, string $backend): void
{
$this->routes[$subdomain] = $backend;
$this->hosts[$subdomain] = $trafficHost;
}
public function remove(string $trafficHost, string $subdomain): void
{
unset($this->routes[$subdomain], $this->hosts[$subdomain]);
}
public function certReachable(string $fqdn): bool
{
return $this->certReady;
}
}