Skip to content

ygouzerh/cloudflare-env-switcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cloudflare Environment Switcher

A bash function to easily switch between different Cloudflare environments by loading environment-specific configuration files.

Features

  • Interactive environment selection using fzf (if available)
  • Direct environment specification via command line argument
  • Displays loaded Cloudflare credentials (with masked API token for security)
  • Lists available environments when selection fails

Setup

  1. Source the script in your shell profile (.bashrc, .zshrc, etc.):

    source <absolute-path>/cfenv.sh
  2. Create environment files in the env-files/ directory with the naming pattern env.{environment_name}:

    env-files/
    ├── env.dev
    ├── env.staging
    └── env.prod
    
  3. Each environment file should contain your Cloudflare credentials:

    export CLOUDFLARE_ACCOUNT_ID="your-account-id"
    export CLOUDFLARE_API_TOKEN="your-api-token"

Usage

Interactive selection (requires fzf):

cfenv

Direct environment specification:

cfenv dev
cfenv staging
cfenv prod

Requirements

  • fzf (optional, for interactive selection)
  • Environment files in env-files/ directory

Security

  • Environment files are ignored by git (see .gitignore)
  • API tokens are displayed with only first and last 4 characters visible

About

A command-line tool for managing and switching between multiple Cloudflare environment configurations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages