Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,12 @@ LIGHTNING_LNBITS_API_KEY=
LIGHTNING_LNBITS_LNURLP_URL=
LIGHTNING_LND_API_URL=
LIGHTNING_LND_ADMIN_MACAROON=
# Path to the live LND TLS cert file on disk (mounted into the container)
# Path to the live LND TLS cert file on disk (mounted into the container).
# Takes precedence over LIGHTNING_API_CERTIFICATE when set.
LIGHTNING_API_CERTIFICATE_PATH=
# TLS certificate for the LND connection (inline PEM, <br> as line separator).
# Only used when LIGHTNING_API_CERTIFICATE_PATH is not set (e.g. Azure).
LIGHTNING_API_CERTIFICATE=

MONERO_WALLET_ADDRESS=
MONERO_NODE_URL=
Expand Down
11 changes: 7 additions & 4 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1287,11 +1287,14 @@ export class Configuration {

function readCert(): string | undefined {
const path = process.env.LIGHTNING_API_CERTIFICATE_PATH;
if (!path) return undefined;
if (path) {
// Path is set: read the live LND cert from disk and let a missing/unreadable file throw,
// so a broken mount surfaces immediately instead of being masked by a stale fallback.
return readFileSync(path, 'utf8');
}

// Path is set: read the live LND cert from disk and let a missing/unreadable file throw,
// so a broken mount surfaces immediately instead of being masked by a stale fallback.
return readFileSync(path, 'utf8');
// Fallback for environments without a cert file mount (e.g. Azure App Service).
return process.env.LIGHTNING_API_CERTIFICATE?.split('<br>').join('\n');
}

function splitWithdrawKeys(value?: string): Map<string, string> {
Expand Down