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,