feat: Stripe secrets pipeline — env wiring, client refactor, health check, k6 test#184
Open
feat: Stripe secrets pipeline — env wiring, client refactor, health check, k6 test#184
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a planning/TODO document describing upcoming work for Stripe secret injection and a follow-up improvement to validate Stripe keys at startup, to avoid silent billing failures.
Changes:
- Introduces
TODOS.mdwith a P2 item for startup Stripe key validation (GET /v1/balance) and associated rollout/behavior notes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Wire STRIPE_SECRET_KEY and STRIPE_PUBLISHABLE_KEY into docker-compose.phala.yml as Phala CVM encrypted env vars (same pattern as BASE_CHAIN_RPC). Refactor the Stripe HTTP client with a 30s request timeout and StripeResponse struct that preserves HTTP status codes — prerequisite for the P2 startup key validation TODO. Add billing_keys_present field to the health endpoint (informational only, does not affect 200/503 status). Add k6 billing correctness spec that verifies GET /billing/stripe_config returns a publishable key on the deployed server. Update deploy-phala.yml header with complete secret inventory. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Log error before silently disabling billing if reqwest client fails - Replace stale line numbers and branch names in TODOS.md with stable refs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Matching the pattern from PR #199 — secrets must be explicitly passed as -e flags to the Phala CLI, not just referenced in docker-compose. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
STRIPE_SECRET_KEYandSTRIPE_PUBLISHABLE_KEYintodocker-compose.phala.ymlas Phala CVM encrypted env vars (same${VAR}pattern asBASE_CHAIN_RPC)StripeResponse { status, body }struct preserving HTTP status codes, sharedparse_stripe_response()helper (DRY)billing_keys_present: boolto health endpoint (informational only — does NOT affect 200/503 status)GET /billing/stripe_configverifies publishable key is returned on deployed serverdeploy-phala.ymlheader with complete secret inventory (GitHub secrets + Phala CVM encrypted env vars)TODOS.mdwith P2 startup Stripe key validation (depends on client refactor shipping here)Context
Billing code exists and works locally, but is silently disabled in all deployed environments because Stripe keys were never injected. This PR closes the gap: keys flow through Phala CVM → container env →
stripe::init()→ billing enabled. The client refactor (HTTP status preservation + timeouts) unblocks the P2 startup validation TODO.Test Coverage
Pre-Landing Review
Pre-Landing Review: 2 issues (0 critical, 2 informational) — all auto-fixed.
Plan Completion
8/10 DONE, 2 NOT DONE (both explicitly deferred during eng review):
TODOS
Test plan
billing.spec.tsvalidatesGET /billing/stripe_configreturnspk_*key on deployed server🤖 Generated with Claude Code