fix stripe for production
Build & Push / Pipeline Tests (push) Successful in 1m51s
Test / Type Check (all packages) (push) Successful in 52s
Test / API Unit Tests (push) Successful in 1m10s
Test / Homepage Unit Tests (push) Successful in 48s
Test / Carplace Unit Tests (push) Successful in 44s
Test / Admin Unit Tests (push) Successful in 44s
Test / Dashboard Unit Tests (push) Successful in 44s
Test / API Integration Tests (push) Successful in 1m7s
Build & Push / Build & Push Docker Image (push) Failing after 41s

This commit is contained in:
root
2026-07-29 01:39:54 -04:00
parent 96d1d2d0d6
commit b944ff554c
8 changed files with 68 additions and 14 deletions
+22 -1
View File
@@ -187,7 +187,7 @@ EOF
}
validate_prod_env_file() {
local acme_email api_domain public_site_domain cors_origins postgres_password redis_password jwt_secret
local acme_email api_domain public_site_domain cors_origins postgres_password redis_password jwt_secret stripe_api_key stripe_webhook_secret
acme_email="$(read_env_value ACME_EMAIL)"
api_domain="$(read_env_value API_DOMAIN)"
@@ -196,6 +196,8 @@ validate_prod_env_file() {
postgres_password="$(read_env_value POSTGRES_PASSWORD)"
redis_password="$(read_env_value REDIS_PASSWORD)"
jwt_secret="$(read_env_value JWT_SECRET)"
stripe_api_key="$(read_env_value STRIPE_API_KEY)"
stripe_webhook_secret="$(read_env_value STRIPE_WEBHOOK_SECRET)"
if [[ -z "${acme_email}" || "${acme_email}" != *@* || "${acme_email}" == *example.com* ]]; then
echo "Invalid ACME_EMAIL in ${ENV_FILE}. Set ACME_EMAIL=${DEFAULT_ACME_EMAIL} for Let's Encrypt." >&2
@@ -226,6 +228,25 @@ validate_prod_env_file() {
fi
done
if [[ -z "${stripe_api_key}" || "${stripe_api_key}" == placeholder || "${stripe_api_key}" == replace-with-* || "${stripe_api_key}" == *changeme* || "${stripe_api_key}" == *change-me* ]]; then
echo "Invalid STRIPE_API_KEY in ${ENV_FILE}. Set a real Stripe secret or restricted API key for production billing." >&2
exit 1
fi
if [[ "${stripe_api_key}" != sk_* && "${stripe_api_key}" != rk_* ]]; then
echo "Invalid STRIPE_API_KEY in ${ENV_FILE}. It must start with sk_ or rk_." >&2
exit 1
fi
if [[ -z "${stripe_webhook_secret}" || "${stripe_webhook_secret}" == placeholder || "${stripe_webhook_secret}" == replace-with-* || "${stripe_webhook_secret}" == *changeme* || "${stripe_webhook_secret}" == *change-me* ]]; then
echo "Invalid STRIPE_WEBHOOK_SECRET in ${ENV_FILE}. Set the Stripe webhook signing secret for /api/v1/subscriptions/webhooks/stripe." >&2
exit 1
fi
if [[ "${stripe_webhook_secret}" != whsec_* ]]; then
echo "Invalid STRIPE_WEBHOOK_SECRET in ${ENV_FILE}. It must start with whsec_." >&2
exit 1
fi
}