From 5815132a736572d24fd0dcaeeec04475ccce7bf2 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 16 Oct 2024 00:57:18 +0200 Subject: [PATCH] change file REGISTRY_AUTH_OVERRIDES_PATH loading to not use require --- swarmgate/routes.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swarmgate/routes.ts b/swarmgate/routes.ts index acf5305..f68986d 100644 --- a/swarmgate/routes.ts +++ b/swarmgate/routes.ts @@ -38,7 +38,8 @@ try { const overrideExists = fs.existsSync(REGISTRY_AUTH_OVERRIDES_PATH); if (overrideExists) { console.log(`Loading registry auth overrides from ${REGISTRY_AUTH_OVERRIDES_PATH}`); - const registryAuthOverridesRaw: RegistryAuthPerDockerRegistry = require(REGISTRY_AUTH_OVERRIDES_PATH); + const fileContents = fs.readFileSync(REGISTRY_AUTH_OVERRIDES_PATH, 'utf8'); + const registryAuthOverridesRaw: RegistryAuthPerDockerRegistry = JSON.parse(fileContents); for (const [registry, auth] of Object.entries(registryAuthOverridesRaw)) { registryAuthOverrides[registry] = auth; }