Preserve LAN worker auth after agent config reload

This commit is contained in:
Jeppe Bundgaard
2026-06-30 11:39:19 +02:00
parent 53246af629
commit acc80920f9
2 changed files with 14 additions and 1 deletions
@@ -2890,7 +2890,10 @@ final class TruckwashEdgeAgent
{
$reloaded = AgentConfig::load($this->config->path);
$this->config = $reloaded;
$this->workerHttp = new HttpJsonClient((string)$this->config->get('workerBaseUrl', self::DEFAULT_WORKER_BASE_URL));
$this->workerHttp = new HttpJsonClient(
(string)$this->config->get('workerBaseUrl', self::DEFAULT_WORKER_BASE_URL),
$this->workerAuthorizationHeaders()
);
$this->configureBrokerClient();
}
@@ -134,6 +134,16 @@ it('builds the installer around the compose stack artifacts and management polli
expect($agentSource)->toContain("'last_transport_failure_at'");
expect($agentSource)->toContain("'last_transport_error'");
expect($agentSource)->toContain('private function recordTransportFailure(string $context, Throwable $throwable): void');
expect($agentSource)->toContain(
"private function reloadConfigFromDisk(): void\n" .
" {\n" .
" \$reloaded = AgentConfig::load(\$this->config->path);\n" .
" \$this->config = \$reloaded;\n" .
" \$this->workerHttp = new HttpJsonClient(\n" .
" (string)\$this->config->get('workerBaseUrl', self::DEFAULT_WORKER_BASE_URL),\n" .
" \$this->workerAuthorizationHeaders()\n" .
' );'
);
expect($edgeDockerfileSource)->toContain('FROM ${BASE_IMAGE}');
expect($edgeDockerfileSource)->not->toContain('docker-php-ext-install');
expect($edgeDockerfileSource)->toContain('extension_loaded($extension)');