Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('<br>').join('\n');

return readFileSync(path, 'utf8');
}
Expand Down
Loading