From f706531534d51b64febbaec158778b5be0c525c2 Mon Sep 17 00:00:00 2001 From: Jeppe Bundgaard Date: Wed, 1 Jul 2026 11:44:36 +0200 Subject: [PATCH] Stabilize gateway E2E broker config --- scripts/test-gateway.mjs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/test-gateway.mjs b/scripts/test-gateway.mjs index 47bb3d3f..b7046e78 100644 --- a/scripts/test-gateway.mjs +++ b/scripts/test-gateway.mjs @@ -12,7 +12,7 @@ export const DEFAULT_IMAGE_TAG = "truckwash-edge-agent:test-gateway"; export const DEFAULT_CONFIG_FILE_NAME = "test-gateway.json"; export const DEFAULT_HOST_API_URL = "http://localhost/api"; export const DEFAULT_CONTAINER_API_URL = "http://caddy"; -export const DEFAULT_CONTAINER_BROKER_URL = "http://edge-broker:4300"; +export const DEFAULT_CONTAINER_BROKER_URL = "ws://edge-broker:4300"; export const DEFAULT_INSTALL_DIR = "/opt/truckwash-edge-agent"; export const DEFAULT_RUNTIME_DIR = `${DEFAULT_INSTALL_DIR}/runtime`; export const DEFAULT_STATE_DATABASE_PATH = `${DEFAULT_RUNTIME_DIR}/gateway-state.sqlite`; @@ -409,14 +409,20 @@ async function startContainer({ }); if (copyConfig) { - await runCommand("docker", [ - "cp", - path.join(configDir, DEFAULT_CONFIG_FILE_NAME), - `${containerName}:${containerConfigPath}`, - ], { - cwd: rootDir, - stdio: "inherit", - }); + const configFilePath = path.join(configDir, DEFAULT_CONFIG_FILE_NAME); + await fs.chmod(configFilePath, 0o666).catch(() => {}); + try { + await runCommand("docker", [ + "cp", + configFilePath, + `${containerName}:${containerConfigPath}`, + ], { + cwd: rootDir, + stdio: "inherit", + }); + } finally { + await fs.chmod(configFilePath, 0o600).catch(() => {}); + } await runCommand("docker", ["start", containerName], { cwd: rootDir,