Skip to content

fix(lightning): restore LIGHTNING_API_CERTIFICATE fallback when no cert path is set#3868

Closed
Danswar wants to merge 1 commit into
developfrom
fix/restore-lightning-cert-env-fallback
Closed

fix(lightning): restore LIGHTNING_API_CERTIFICATE fallback when no cert path is set#3868
Danswar wants to merge 1 commit into
developfrom
fix/restore-lightning-cert-env-fallback

Conversation

@Danswar

@Danswar Danswar commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #3861, per David's 06-11 review note: prod dfx-api is not hosted on DFX servers yet (no local lnd / lightning volume to mount), so removing LIGHTNING_API_CERTIFICATE entirely left prod with no cert source once this code reaches it.

This restores the env var as the fallback only when LIGHTNING_API_CERTIFICATE_PATH is unset (hosts without the mount, i.e. today's prod). The fail-loud behavior David asked for is unchanged: when the path is set, the live file is read and a missing/unreadable file still throws at startup — a broken mount can't be masked by a stale env var, because the fallback is never consulted in that case.

  • readCert(): unset path → LIGHTNING_API_CERTIFICATE (same <br>→newline handling as before feat(lightning): support loading LND TLS certificate from file #3861); set path → read-or-throw (unchanged)
  • .env.example: LIGHTNING_API_CERTIFICATE re-added with a comment explaining the precedence
  • dfxdev keeps using the file path (mount restored separately in DFXServer/server#378); the Vault cleanup of the prod env var is deferred until prod migrates onto DFX servers

tsc clean.

…rt path is set

Per review on #3861: prod dfx-api is not hosted on DFX servers yet, so it has
no LND lightning volume to mount — removing the env var entirely left prod
with no cert source once this code ships there. Restore the env var as the
fallback for hosts without the mount; when LIGHTNING_API_CERTIFICATE_PATH is
set it still reads the live file and throws if unreadable (fail-loud mount
check unchanged).
@davidleomay

Copy link
Copy Markdown
Member

Duplicate of #3867

@davidleomay davidleomay marked this as a duplicate of #3867 Jun 11, 2026
@Danswar

Danswar commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

Same fix, you were faster 🙂 — #3867 covers it.

@Danswar Danswar deleted the fix/restore-lightning-cert-env-fallback branch June 11, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants