diff --git a/bouncer/src/Bouncer.php b/bouncer/src/Bouncer.php index d5fdcd8..ac54ca7 100644 --- a/bouncer/src/Bouncer.php +++ b/bouncer/src/Bouncer.php @@ -669,6 +669,15 @@ class Bouncer if ($this->s3Enabled()) { $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(); } diff --git a/bouncer/src/Target.php b/bouncer/src/Target.php index 06373db..fee7add 100644 --- a/bouncer/src/Target.php +++ b/bouncer/src/Target.php @@ -31,6 +31,8 @@ class Target private ?string $hostOverride = null; private ?string $customNginxConfig = null; + private bool $requiresForcedScanning = false; + public function __construct( private Logger $logger, 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->setRequiresForcedScanning(true); return false; } @@ -480,4 +483,14 @@ class Target { return $this->customNginxConfig !== null; } + + public function requiresForcedScanning(): bool + { + return $this->requiresForcedScanning; + } + + public function setRequiresForcedScanning(bool $requiresForcedScanning): void + { + $this->requiresForcedScanning = $requiresForcedScanning; + } }