Add scan-forcing.
This commit is contained in:
parent
53fcb004c9
commit
ee66c49987
2 changed files with 22 additions and 0 deletions
bouncer/src
|
@ -669,6 +669,15 @@ class Bouncer
|
||||||
if ($this->s3Enabled()) {
|
if ($this->s3Enabled()) {
|
||||||
$this->writeCertificatesToS3();
|
$this->writeCertificatesToS3();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if any of the targets has requiresForcedScanning set to true, we need to force an update
|
||||||
|
if (array_reduce($targets, fn ($carry, $target) => $carry || $target->requiresForcedScanning(), false)) {
|
||||||
|
$this->logger->warning('Forcing an update in 5 seconds because one or more targets require it.', ['emoji' => Emoji::warning()]);
|
||||||
|
sleep(5);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait for next change
|
||||||
$this->waitUntilContainerChange();
|
$this->waitUntilContainerChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@ class Target
|
||||||
private ?string $hostOverride = null;
|
private ?string $hostOverride = null;
|
||||||
private ?string $customNginxConfig = null;
|
private ?string $customNginxConfig = null;
|
||||||
|
|
||||||
|
private bool $requiresForcedScanning = false;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private Logger $logger,
|
private Logger $logger,
|
||||||
private Settings $settings,
|
private Settings $settings,
|
||||||
|
@ -448,6 +450,7 @@ class Target
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->logger->critical('isEndpointValid: {endpoint} is a hostname that does not resolve', ['emoji' => Emoji::magnifyingGlassTiltedRight(), 'endpoint' => $this->getEndpointHostnameOrIp()]);
|
$this->logger->critical('isEndpointValid: {endpoint} is a hostname that does not resolve', ['emoji' => Emoji::magnifyingGlassTiltedRight(), 'endpoint' => $this->getEndpointHostnameOrIp()]);
|
||||||
|
$this->setRequiresForcedScanning(true);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -480,4 +483,14 @@ class Target
|
||||||
{
|
{
|
||||||
return $this->customNginxConfig !== null;
|
return $this->customNginxConfig !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function requiresForcedScanning(): bool
|
||||||
|
{
|
||||||
|
return $this->requiresForcedScanning;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRequiresForcedScanning(bool $requiresForcedScanning): void
|
||||||
|
{
|
||||||
|
$this->requiresForcedScanning = $requiresForcedScanning;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue