feat(secrets): fetch Group-2 SMTP secret from Infisical at runtime (app-native, BUNYIP-525) #523
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/BUNYIP-525-infisical-runtime-fetch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
App-native runtime fetch of the Group-2 SMTP secret from Infisical (BUNYIP-525). Replaces the reverted host-side render / agent-sidecar attempts (docker #343, #345). Per David: no Infisical CLI or sidecar anywhere; bunyip-api itself fetches its Group-2 integration secrets.
What it does
crates/bunyip-domain/src/services/infisical.rs.reqwest(5s timeout), NOT theinfisicalcrate (it is v0.0.3 / unstable); against Infisical's stable REST API.main.rs): runs only whenINFISICAL_ENABLEDis set and the env/fileSMTP_PASSWORDis empty; fetchesSMTP_PASSWORDand populates theconfig.email.smtp_passwordfallback slot BEFORE the DB-over-env email resolution, so the DBemail_configrow still wins and Infisical is only the fallback. Any failure resolves toNone, so the app always starts (email degrades) and Infisical is never a boot dependency.INFISICAL_ENABLED/_ADDRESS/_PROJECT_ID/_ENV/_SECRET_PATH(non-secret, compose-variables);INFISICAL_CLIENT_ID/_CLIENT_SECRETviasecret_env(SOPS, honoring{NAME}_FILE). Off by default.CLAUDE.md+docs/secrets-infisical.mdupdated to the two-tier model.Validated / not
cargo fmt --check;cargo clippy --workspace --all-targets -- -D warnings(compiles + lints every target, including the new unit tests). Unit tests cover URL building, camelCase login body, and login + secret JSON parsing.cargo testOOM-kills compilingasync-stripeon the 12-16GB dev box (environmental, unrelated to this change). CI runs the tests on proper runners.GET /api/v3/secrets/raw/{name}?workspaceId=...); confirm it against the deployed Infisical version (v4 alternative noted in a comment), and validate a live fetch againstinfisical.a8n.systems.Operator steps to enable (per host)
Move
INFISICAL_CLIENT_ID/INFISICAL_CLIENT_SECRETunderservices.appin the docker repo SOPScompose-secrets.yml; setINFISICAL_ENABLED=true+INFISICAL_ADDRESS(a8n.systems staging / psa.systems prod) +INFISICAL_PROJECT_ID(ab5c411a-...) +INFISICAL_ENV+INFISICAL_SECRET_PATH=/bunyip/runtimein compose-variables; seedSMTP_PASSWORDin the Infisical folder; optionally removeSMTP_PASSWORDfrom SOPS so the Infisical value is used.