BOUNCER_NAME => BOUNCER_LABEL

This commit is contained in:
Greyscale 2024-01-25 16:00:57 +01:00
parent d9ead59397
commit 190c222e19
No known key found for this signature in database
GPG key ID: 74BAFF55434DA4B2
2 changed files with 14 additions and 8 deletions

View file

@ -328,8 +328,8 @@ class Bouncer
{
foreach ($envs as $eKey => $eVal) {
switch ($eKey) {
case 'BOUNCER_NAME':
$bouncerTarget->setName($eVal);
case 'BOUNCER_LABEL':
$bouncerTarget->setLabel($eVal);
break;
@ -692,8 +692,7 @@ class Bouncer
}
if (count($changedTargets) <= $this->getMaximumNginxConfigCreationNotices()) {
foreach ($changedTargets as $target) {
$this->logger->info('{emoji} Created {name}', ['emoji' => Emoji::pencil(), 'name' => $target->getName()]);
$this->logger->debug('{emoji} -> {certs_dir}/{file}', ['emoji' => Emoji::pencil(), 'certs_dir' => Bouncer::FILESYSTEM_CERTS_DIR, 'file' => $target->getFileName()]);
$this->logger->info('{emoji} Created {label}', ['emoji' => Emoji::pencil(), 'label' => $target->getLabel()]);
$this->logger->debug('{emoji} -> {domain}', ['emoji' => Emoji::pencil(), 'domain' => $target->getPresentationDomain()]);
}
} else {

View file

@ -10,7 +10,7 @@ use Spatie\Emoji\Emoji;
class Target
{
private string $id;
private ?string $name = null;
private ?string $label = null;
private array $domains;
private string $endpointHostnameOrIp;
private ?int $port = null;
@ -37,6 +37,7 @@ class Target
return [
'id' => $this->getId(),
'name' => $this->getName(),
'label' => $this->getLabel(),
'domains' => $this->getDomains(),
'letsEncrypt' => $this->isLetsEncrypt(),
'targetPath' => $this->getTargetPath(),
@ -275,13 +276,19 @@ class Target
public function getName()
{
return $this->name ?? reset($this->domains);
return reset($this->domains);
}
public function setName(string $name): self
public function getLabel()
{
$this->name = $name;
return $this->label ?? $this->getLabel();
}
public function setLabel(string $label): self
{
$this->label = $label;
$this->updateLogger();
$this->logger->debug('{emoji} Target label set to {label}', ['emoji' => Emoji::label(), 'label' => $label]);
return $this;
}