From 5355ae62fd9e502bb5ec6941a2967034ba6babc0 Mon Sep 17 00:00:00 2001 From: Daniel Padrino Date: Thu, 11 Jun 2026 10:54:40 -0300 Subject: [PATCH] fix(config): restore LIGHTNING_API_CERTIFICATE fallback when no cert path is set Per review on #200: environments without the LND lightning volume (e.g. prod hosted off DFX servers) have no file to mount, so dropping the env var left them without a cert source. Restore it as the fallback when LIGHTNING_API_CERTIFICATE_PATH is unset; a set-but-unreadable path still throws (fail-loud mount check unchanged). --- src/config/config.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/config/config.ts b/src/config/config.ts index dac6f892dd..34e59c82ad 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -24,12 +24,13 @@ export function GetConfig(): Configuration { } // Reads the live LND TLS certificate from the file pointed to by LIGHTNING_API_CERTIFICATE_PATH. -// If the path is unset, returns undefined (environments without Lightning, e.g. tests, still boot). +// If the path is unset, falls back to the LIGHTNING_API_CERTIFICATE env var (hosts without the +// LND volume, e.g. prod hosted off DFX servers; tests and non-Lightning envs still boot). // If the path is set but the file is missing/unreadable, readFileSync throws so a broken mount // surfaces immediately instead of being masked by a stale fallback. function readCert(): string | undefined { const path = process.env.LIGHTNING_API_CERTIFICATE_PATH; - if (!path) return undefined; + if (!path) return process.env.LIGHTNING_API_CERTIFICATE?.split('
').join('\n'); return readFileSync(path, 'utf8'); }