fix(db): make postgres SSL opt-in via SQL_SSL=true#181
Merged
TaprootFreak merged 2 commits intodevelopfrom May 8, 2026
Merged
Conversation
Stage 2 was running 'npm ci --omit=dev' from scratch, which triggers node-gyp on native deps (solana/eth signers) and fails the same way stage 1 did before — the runtime image base also lacks python/g++. Fix: do 'npm prune --omit=dev' in the builder (drop dev-only deps from the existing node_modules tree, keeping the already-compiled native binaries) and COPY node_modules across to the final stage. This avoids ever re-running node-gyp at runtime-image-build time and keeps the runtime base small (no python/toolchain there).
The hardcoded { rejectUnauthorized: false } SSL config forces a TLS
handshake against the postgres host even when the server doesn't speak
SSL — which breaks the dfxdev/dfxprd setup where lds-api talks to a
local api-postgres container without SSL.
Error: The server does not support SSL connections
Make it opt-in: SSL only when SQL_SSL=true (the Azure-hosted PostgreSQL
Flexible Server expects it; the new container-postgres does not).
24bb2cf to
260e332
Compare
davidleomay
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make the postgres SSL config controllable via env-var instead of being hardcoded.
The hardcoded
ssl: { rejectUnauthorized: false }insrc/config/config.tsalways negotiates TLS to the postgres host. That breaks the dfxdev/dfxprd setup where the API talks to a localapi-postgrescontainer that doesn't speak SSL:Fix
SSL-on stays the default (matches the previous behaviour).
SQL_SSL=falseopts out for hosts where the postgres peer doesn't speak TLS.psql-lds-api-{prd,dev}(Flexible Server,require_secure_transport=on) → no change needed, default still SSL.SQL_SSL=falsein the vault item / .env.Includes
Test plan
SQL_SSL=falsethe lds-api container connects to api-postgres and goes healthyLDS API DEV CI/CDbuilds and pusheslightningdotspacecom/lds-api:beta