stripe build fix
Build & Push / Pipeline Tests (push) Successful in 1m49s
Test / Type Check (all packages) (push) Successful in 53s
Build & Push / Build & Push Docker Image (push) Failing after 33s
Test / API Unit Tests (push) Successful in 1m9s
Test / Homepage Unit Tests (push) Successful in 50s
Test / Carplace Unit Tests (push) Successful in 44s
Test / Admin Unit Tests (push) Successful in 43s
Test / Dashboard Unit Tests (push) Successful in 47s
Test / API Integration Tests (push) Successful in 1m8s
Build & Push / Pipeline Tests (push) Successful in 1m49s
Test / Type Check (all packages) (push) Successful in 53s
Build & Push / Build & Push Docker Image (push) Failing after 33s
Test / API Unit Tests (push) Successful in 1m9s
Test / Homepage Unit Tests (push) Successful in 50s
Test / Carplace Unit Tests (push) Successful in 44s
Test / Admin Unit Tests (push) Successful in 43s
Test / Dashboard Unit Tests (push) Successful in 47s
Test / API Integration Tests (push) Successful in 1m8s
This commit is contained in:
@@ -68,6 +68,10 @@ describe_value() {
|
||||
printf '%s: missing\n' "${key}"
|
||||
elif [[ "${value}" == placeholder || "${value}" == replace-with-* || "${value}" == *changeme* || "${value}" == *change-me* ]]; then
|
||||
printf '%s: placeholder\n' "${key}"
|
||||
elif [[ "${key}" == STRIPE_BILLING_REQUIRED && ( "${value}" == "true" || "${value}" == "1" || "${value}" == "yes" ) ]]; then
|
||||
printf '%s: enabled\n' "${key}"
|
||||
elif [[ "${key}" == STRIPE_BILLING_REQUIRED && ( "${value}" == "false" || "${value}" == "0" || "${value}" == "no" ) ]]; then
|
||||
printf '%s: disabled\n' "${key}"
|
||||
elif [[ "${key}" == STRIPE_API_KEY && ( "${value}" == sk_live_* || "${value}" == rk_live_* ) ]]; then
|
||||
printf '%s: valid live prefix\n' "${key}"
|
||||
elif [[ "${key}" == STRIPE_WEBHOOK_SECRET && "${value}" == whsec_* ]]; then
|
||||
|
||||
@@ -181,7 +181,7 @@ EOF
|
||||
}
|
||||
|
||||
validate_prod_env_file() {
|
||||
local acme_email api_domain public_site_domain cors_origins portainer_domain postgres_password redis_password jwt_secret stripe_api_key stripe_webhook_secret
|
||||
local acme_email api_domain public_site_domain cors_origins portainer_domain postgres_password redis_password jwt_secret stripe_api_key stripe_webhook_secret stripe_billing_required
|
||||
|
||||
acme_email="$(read_env_value ACME_EMAIL)"
|
||||
api_domain="$(read_env_value API_DOMAIN)"
|
||||
@@ -193,6 +193,7 @@ validate_prod_env_file() {
|
||||
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)"
|
||||
stripe_billing_required="$(read_env_value STRIPE_BILLING_REQUIRED)"
|
||||
|
||||
if [[ -z "${acme_email}" || "${acme_email}" != *@* || "${acme_email}" == *example.com* ]]; then
|
||||
echo "Invalid ACME_EMAIL in ${ENV_FILE}. Set it to a real contact email for Let's Encrypt, not example.com." >&2
|
||||
@@ -223,25 +224,23 @@ 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
|
||||
if [[ "${stripe_billing_required}" == "false" || "${stripe_billing_required}" == "0" || "${stripe_billing_required}" == "no" ]]; then
|
||||
echo "Stripe billing validation skipped because STRIPE_BILLING_REQUIRED=${stripe_billing_required}." >&2
|
||||
echo "Stripe checkout and Stripe webhooks will remain unavailable until STRIPE_API_KEY and STRIPE_WEBHOOK_SECRET are configured." >&2
|
||||
elif [[ -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
|
||||
echo "Set STRIPE_API_KEY as a Gitea Actions secret, or include STRIPE_API_KEY=sk_live_.../rk_live_... in ENV_DOCKER_PRODUCTION_B64." >&2
|
||||
echo "If you need to deploy before Stripe is ready, set STRIPE_BILLING_REQUIRED=false in the production env file." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${stripe_api_key}" != sk_live_* && "${stripe_api_key}" != rk_live_* ]]; then
|
||||
elif [[ "${stripe_api_key}" != sk_live_* && "${stripe_api_key}" != rk_live_* ]]; then
|
||||
echo "Invalid STRIPE_API_KEY in ${ENV_FILE}. It must start with sk_live_ or rk_live_ for production billing." >&2
|
||||
echo "Use a live Stripe secret key or, preferably, a live restricted key with the required billing permissions." >&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
|
||||
elif [[ -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
|
||||
echo "Set STRIPE_WEBHOOK_SECRET as a Gitea Actions secret, or include STRIPE_WEBHOOK_SECRET=whsec_... in ENV_DOCKER_PRODUCTION_B64." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${stripe_webhook_secret}" != whsec_* ]]; then
|
||||
elif [[ "${stripe_webhook_secret}" != whsec_* ]]; then
|
||||
echo "Invalid STRIPE_WEBHOOK_SECRET in ${ENV_FILE}. It must start with whsec_." >&2
|
||||
echo "Use the webhook signing secret from the Stripe webhook endpoint, not the Stripe API key." >&2
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user