Files
cloudlysis/scripts/billing/swarm-secrets-sample.sh
Vlad Durnea 2595e7f1c5
Some checks failed
ci / ui (push) Failing after 28s
ci / rust (push) Failing after 2m40s
images / build-and-push (push) Failing after 19s
feat(billing): implement tenant subscription entitlements system (milestones 0-6)
2026-03-30 18:41:23 +03:00

37 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -e
# sample-secrets.sh
# This script demonstrates how to provision the necessary Swarm secrets
# for the billing system.
# 1. Stripe Secret Key (from Stripe Dashboard -> Developers -> API keys)
# Usage: echo "sk_test_..." | ./sample-secrets.sh
if [ -t 0 ]; then
echo "Error: Please pipe the Stripe Secret Key into this script."
echo "Example: echo \"sk_test_...\" | $0"
exit 1
fi
STRIPE_SK=$(cat -)
echo "Creating 'control_stripe_secret_key' secret..."
echo "$STRIPE_SK" | docker secret create control_stripe_secret_key -
# 2. Stripe Webhook Secret (from Stripe Dashboard -> Developers -> Webhooks -> [Endpoint])
# Note: You get this after configuring the endpoint in the dashboard.
echo "NOTE: Remember to also create 'control_stripe_webhook_secret' once you have it."
# echo "whsec_..." | docker secret create control_stripe_webhook_secret -
echo "Done. Update your stack file to reference these secrets:"
echo "
services:
control-api:
secrets:
- control_stripe_secret_key
- control_stripe_webhook_secret
environment:
- CONTROL_STRIPE_SECRET_KEY_FILE=/run/secrets/control_stripe_secret_key
- CONTROL_STRIPE_WEBHOOK_SECRET_FILE=/run/secrets/control_stripe_webhook_secret
"