Configuration
BearFlare supports three configuration methods with a clear priority system. This guide explains how to set up your Cloudflare credentials and configure BearFlare.
Configuration Priority
BearFlare checks environment variables first, then ~/.bearflare/.config, then .env in your project.
Required Variables
You must provide the following three variables:
| Variable | Description |
|---|---|
CLOUDFLARE_ACCOUNT_ID | Your Cloudflare account ID |
CLOUDFLARE_API_TOKEN | API token with D1 database permissions |
CLOUDFLARE_D1_DATABASE_ID | Target D1 database ID |
Configuration File Format
Create a configuration file with the following format:
CLOUDFLARE_ACCOUNT_ID=abc123...
CLOUDFLARE_API_TOKEN=xxxxx
CLOUDFLARE_D1_DATABASE_ID=def456...
Example: Home Config File (~/.bearflare/.config)
# Cloudflare D1 Configuration
CLOUDFLARE_ACCOUNT_ID=abc123def456ghi789
CLOUDFLARE_API_TOKEN=your_api_token_here
CLOUDFLARE_D1_DATABASE_ID=your_database_id_here
Example: Project .env File
# Project-specific Cloudflare D1 Configuration
CLOUDFLARE_ACCOUNT_ID=project_specific_account_id
CLOUDFLARE_API_TOKEN=project_specific_token
CLOUDFLARE_D1_DATABASE_ID=project_specific_database_id
Obtaining Cloudflare Credentials
- Account ID: Log in to Cloudflare Dashboard - your Account ID is in the right sidebar
- API Token: Go to API Tokens, create a token with D1 Edit permissions
- Database ID: Navigate to D1 and select your database
warning
API tokens are only shown once when created. Make sure to save it securely!
Security Best Practices
danger
Never commit credentials to version control!
Add .env to your .gitignore file and never commit config files with real credentials.
Next Steps
Once you've configured your credentials, head to the Usage guide to learn how to sync your Bear notes.