LogoLogo
HomeAPIBlog
3.0.0-SNAPSHOT
3.0.0-SNAPSHOT
  • INTRODUCTION
    • Getting Started
      • Running Local Development Servers
      • Beginner Tutorial: Hello World
      • Beginner Tutorial: Hello Database
      • Tutorial: Wheels, AJAX, and You
    • Frameworks and Wheels
    • Requirements
    • Manual Installation
    • Upgrading
    • Screencasts
  • Command Line Tools
    • CLI Overview
    • Quick Start Guide
    • Command Reference
      • Core Commands
        • wheels init
        • wheels info
        • wheels reload
        • wheels deps
        • wheels destroy
        • wheels watch
      • Code Generation
        • wheels generate app
        • wheels generate app-wizard
        • wheels generate controller
        • wheels generate model
        • wheels generate view
        • wheels generate property
        • wheels generate route
        • wheels generate resource
        • wheels generate api-resource
        • wheels generate frontend
        • wheels generate test
        • wheels generate snippets
        • wheels scaffold
      • Database Commands
        • wheels dbmigrate info
        • wheels dbmigrate latest
        • wheels dbmigrate up
        • wheels dbmigrate down
        • wheels dbmigrate reset
        • wheels dbmigrate exec
        • wheels dbmigrate create blank
        • wheels dbmigrate create table
        • wheels dbmigrate create column
        • wheels dbmigrate remove table
        • wheels db schema
        • wheels db seed
      • Testing Commands
        • wheels test
        • wheels test run
        • wheels test coverage
        • wheels test debug
      • Configuration Commands
        • wheels config list
        • wheels config set
        • wheels config env
      • Environment Management
        • wheels env
        • wheels env setup
        • wheels env list
        • wheels env switch
      • Plugin Management
        • wheels plugins
        • wheels plugins list
        • wheels plugins install
        • wheels plugins remove
      • Code Analysis
        • wheels analyze
        • wheels analyze code
        • wheels analyze performance
        • wheels analyze security
      • Security Commands
        • wheels security
        • wheels security scan
      • Performance Commands
        • wheels optimize
        • wheels optimize performance
      • Documentation Commands
        • wheels docs
        • wheels docs generate
        • wheels docs serve
      • CI/CD Commands
        • wheels ci init
      • Docker Commands
        • wheels docker init
        • wheels docker deploy
      • Deployment Commands
        • wheels deploy
        • wheels deploy audit
        • wheels deploy exec
        • wheels deploy hooks
        • wheels deploy init
        • wheels deploy lock
        • wheels deploy logs
        • wheels deploy proxy
        • wheels deploy push
        • wheels deploy rollback
        • wheels deploy secrets
        • wheels deploy setup
        • wheels deploy status
        • wheels deploy stop
    • CLI Development Guides
      • Creating Commands
      • Service Architecture
      • Migrations Guide
      • Testing Guide
  • Working with Wheels
    • Conventions
    • Configuration and Defaults
    • Directory Structure
    • Switching Environments
    • Testing Your Application
    • Using the Test Environment
    • Contributing to Wheels
    • Submitting Pull Requests
    • Documenting your Code
  • Handling Requests with Controllers
    • Request Handling
    • Rendering Content
    • Redirecting Users
    • Sending Files
    • Sending Email
    • Responding with Multiple Formats
    • Using the Flash
    • Using Filters
    • Verification
    • Event Handlers
    • Routing
    • URL Rewriting
      • Apache
      • IIS
      • Tomcat
      • Nginx
    • Obfuscating URLs
    • Caching
    • Nesting Controllers
    • CORS Requests
  • Displaying Views to Users
    • Pages
    • Partials
    • Linking Pages
    • Layouts
    • Form Helpers and Showing Errors
    • Displaying Links for Pagination
    • Date, Media, and Text Helpers
    • Creating Custom View Helpers
    • Localization
  • Database Interaction Through Models
    • Object Relational Mapping
    • Creating Records
    • Reading Records
    • Updating Records
    • Deleting Records
    • Column Statistics
    • Dynamic Finders
    • Getting Paginated Data
    • Associations
    • Nested Properties
    • Object Validation
    • Object Callbacks
    • Calculated Properties
    • Transactions
    • Dirty Records
    • Soft Delete
    • Automatic Time Stamps
    • Database Migrations
      • Migrations in Production
    • Using Multiple Data Sources
  • Plugins
    • Installing and Using Plugins
    • Developing Plugins
    • Publishing Plugins
  • Project Documentation
    • Overview
  • External Links
    • Source Code
    • Issue Tracker
    • Sponsor Us
    • Community
Powered by GitBook
LogoLogo
On this page
  • Synopsis
  • Description
  • Subcommands
  • Options
  • Direct Usage
  • Examples
  • Show current environment
  • Quick environment info
  • List all environments
  • Switch environment
  • Environment Configuration
  • Environment Variables
  • Environment Detection
  • Common Environments
  • Development
  • Testing
  • Production
  • Staging
  • Environment Files
  • .wheels-env
  • .env.[environment]
  • Integration
  • With Other Commands
  • In Application Code
  • Best Practices
  • Use Cases
  • Notes
  • See Also

Was this helpful?

Edit on GitHub
Export as PDF
  1. Command Line Tools
  2. Command Reference
  3. Environment Management

wheels env

Base command for environment management in Wheels applications.

Synopsis

wheels env [subcommand] [options]

Description

The wheels env command provides comprehensive environment management for Wheels applications. It handles environment configuration, switching between environments, and managing environment-specific settings.

Subcommands

Command
Description

setup

Setup a new environment

list

List available environments

switch

Switch to a different environment

Options

Option
Description

--help

Show help information

--version

Show version information

Direct Usage

When called without subcommands, displays current environment:

wheels env

Output:

Current Environment: development
Configuration File: /config/development/settings.cfm
Database: wheels_dev
Mode: development
Debug: enabled

Examples

Show current environment

wheels env

Quick environment info

wheels env --info

List all environments

wheels env list

Switch environment

wheels env switch production

Environment Configuration

Each environment has its own configuration:

/config/
  ├── development/
  │   └── settings.cfm
  ├── testing/
  │   └── settings.cfm
  ├── production/
  │   └── settings.cfm
  └── environment.cfm

Environment Variables

The command respects these environment variables:

Variable
Description
Default

WHEELS_ENV

Current environment

development

WHEELS_DATASOURCE

Database name

Per environment

WHEELS_DEBUG

Debug mode

Per environment

Environment Detection

Order of precedence:

  1. Command line argument

  2. WHEELS_ENV environment variable

  3. .wheels-env file

  4. Default (development)

Common Environments

Development

  • Debug enabled

  • Detailed error messages

  • Hot reload active

  • Development database

Testing

  • Test database

  • Fixtures loaded

  • Debug enabled

  • Isolated from production

Production

  • Debug disabled

  • Optimized performance

  • Production database

  • Error handling active

Staging

  • Production-like

  • Separate database

  • Debug configurable

  • Pre-production testing

Environment Files

.wheels-env

Local environment override:

production

.env.[environment]

Environment-specific variables:

# .env.production
DATABASE_URL=mysql://prod@host/db
CACHE_ENABLED=true
DEBUG_MODE=false

Integration

With Other Commands

Many commands respect current environment:

# Uses current environment's database
wheels dbmigrate latest

# Reloads in current environment
wheels reload

# Tests run in test environment
wheels test run

In Application Code

Access current environment:

<cfset currentEnv = get("environment")>
<cfif currentEnv eq "production">
    <!--- Production-specific code --->
</cfif>

Best Practices

  1. Never commit .wheels-env file

  2. Use testing environment for tests

  3. Match staging to production closely

  4. Separate databases per environment

  5. Environment-specific configuration files

Use Cases

  1. Local Development: Switch between feature environments

  2. Testing: Isolated test environment

  3. Deployment: Environment-specific configurations

  4. Debugging: Quick environment switching

  5. Team Development: Consistent environments

Notes

  • Environment changes may require application restart

  • Database connections are environment-specific

  • Some settings only take effect after reload

  • Use version control for environment configs

See Also

PreviousEnvironment ManagementNextwheels env setup

Last updated 2 days ago

Was this helpful?

- Setup new environment

- List environments

- Switch environments

- Configuration management

wheels env setup
wheels env list
wheels env switch
wheels config