Files
proxmox/scripts/archive/consolidated/deploy/setup-cloudflare-env.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

103 lines
2.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Interactive setup for Cloudflare API credentials
# Usage: ./setup-cloudflare-env.sh
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ENV_FILE="$SCRIPT_DIR/../.env"
echo "Cloudflare API Credentials Setup"
echo "================================="
echo ""
# Check if .env exists
if [[ -f "$ENV_FILE" ]]; then
echo "Found existing .env file: $ENV_FILE"
read -p "Overwrite? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Keeping existing .env file"
exit 0
fi
fi
echo ""
echo "Choose authentication method:"
echo "1. API Token (Recommended - more secure)"
echo "2. Email + API Key (Legacy)"
read -p "Choice [1-2]: " -n 1 -r
echo ""
if [[ $REPLY == "1" ]]; then
echo ""
echo "Get your API Token from:"
echo " https://dash.cloudflare.com/profile/api-tokens"
echo " Create token with: Zone:Edit, Account:Cloudflare Tunnel:Edit permissions"
echo ""
read -p "Enter Cloudflare API Token: " -s CLOUDFLARE_API_TOKEN
echo ""
if [[ -z "$CLOUDFLARE_API_TOKEN" ]]; then
echo "Error: API Token cannot be empty"
exit 1
fi
cat > "$ENV_FILE" <<EOF
# Cloudflare API Configuration
CLOUDFLARE_API_TOKEN="${CLOUDFLARE_API_TOKEN}"
# Domain
DOMAIN="d-bis.org"
# Optional: Zone ID (will be auto-detected if not set)
# CLOUDFLARE_ZONE_ID=""
# Optional: Account ID (will be auto-detected if not set)
# CLOUDFLARE_ACCOUNT_ID=""
# Tunnel Token (already installed)
TUNNEL_TOKEN="eyJhIjoiNTJhZDU3YTcxNjcxYzVmYzAwOWVkZjA3NDQ2NTgxOTYiLCJ0IjoiMTBhYjIyZGEtOGVhMy00ZTJlLWE4OTYtMjdlY2UyMjExYTA1IiwicyI6IlptRXlOMkkyTVRrdE1EZzFNeTAwTkRBNExXSXhaalF0Wm1KaE5XVmpaVEEzTVdGbCJ9"
EOF
elif [[ $REPLY == "2" ]]; then
echo ""
read -p "Enter Cloudflare Email: " CLOUDFLARE_EMAIL
read -p "Enter Cloudflare API Key: " -s CLOUDFLARE_API_KEY
echo ""
if [[ -z "$CLOUDFLARE_EMAIL" ]] || [[ -z "$CLOUDFLARE_API_KEY" ]]; then
echo "Error: Email and API Key cannot be empty"
exit 1
fi
cat > "$ENV_FILE" <<EOF
# Cloudflare API Configuration
CLOUDFLARE_EMAIL="${CLOUDFLARE_EMAIL}"
CLOUDFLARE_API_KEY="${CLOUDFLARE_API_KEY}"
# Domain
DOMAIN="d-bis.org"
# Optional: Zone ID (will be auto-detected if not set)
# CLOUDFLARE_ZONE_ID=""
# Optional: Account ID (will be auto-detected if not set)
# CLOUDFLARE_ACCOUNT_ID=""
# Tunnel Token (already installed)
TUNNEL_TOKEN="eyJhIjoiNTJhZDU3YTcxNjcxYzVmYzAwOWVkZjA3NDQ2NTgxOTYiLCJ0IjoiMTBhYjIyZGEtOGVhMy00ZTJlLWE4OTYtMjdlY2UyMjExYTA1IiwicyI6IlptRXlOMkkyTVRrdE1EZzFNeTAwTkRBNExXSXhaalF0Wm1KaE5XVmpaVEEzTVdGbCJ9"
EOF
else
echo "Invalid choice"
exit 1
fi
chmod 600 "$ENV_FILE"
echo ""
echo "✓ Credentials saved to: $ENV_FILE"
echo ""
echo "Next step: Run ./scripts/configure-cloudflare-api.sh"