# Cloudflare Credentials Web Setup

A web-based interface to configure your Cloudflare API credentials.

## Quick Start

1. **Start the web server:**
   ```bash
   ./scripts/start-cloudflare-setup.sh
   ```

2. **Open in your browser:**
   - http://localhost:5000
   - http://127.0.0.1:5000

3. **Fill in the form:**
   - Enter your Cloudflare email
   - Add your Global API Key or API Token
   - Optionally add Account ID, Zone ID, Domain, and Tunnel Token
   - Click "Save Credentials"

4. **Test your connection:**
   - Click "Test API Connection" to verify credentials work

5. **Stop the server:**
   - Press `Ctrl+C` in the terminal

## Features

- ✅ View current credential status
- ✅ Update credentials via web form
- ✅ Test API connection
- ✅ Secure (only accessible from localhost)
- ✅ Automatically saves to `.env` file

## Getting Your Credentials

### Global API Key
1. Go to: https://dash.cloudflare.com/profile/api-tokens
2. Scroll to **API Keys** section
3. Click **View** next to **Global API Key**
4. Enter your password
5. Copy the key

### API Token (Recommended)
1. Go to: https://dash.cloudflare.com/profile/api-tokens
2. Click **Create Token**
3. Use **Edit zone DNS** template
4. Add permission: **Account** → **Cloudflare Tunnel** → **Edit**
5. Copy the token

### Account ID & Zone ID
- Found in your Cloudflare dashboard
- Or use the web interface to test and it will help you find them

## Troubleshooting

**Port 5000 already in use?**
- The script will show an error
- Kill the process: `lsof -ti:5000 | xargs kill -9`
- Or modify the port in `cloudflare-setup-web.py`

**Can't access from browser?**
- Make sure you're accessing from the same machine
- The server only listens on localhost (127.0.0.1) for security

