wheels env
Base command for environment management in Wheels applications.
Usage
wheels env [subcommand]
Description
The wheels env
command provides environment management for Wheels applications. It handles environment configuration, switching between environments, and managing environment-specific settings.
Subcommands
list
List all configured environments
setup
Setup a new environment
switch
Switch to a different environment
Direct Usage
When called without subcommands, displays help information:
wheels env
Output:
🌍 Wheels Environment Management
Available commands:
wheels env list
List all configured environments
wheels env setup <environment>
Setup a new environment (development, staging, production)
Options: --template=docker --database=postgres
wheels env switch <environment>
Switch to a different environment
Examples:
wheels env setup development
wheels env setup production --template=docker --database=postgres
wheels env switch staging
Examples
List all environments
wheels env list
Setup new environment
wheels env setup development
wheels env setup production --template=docker --database=postgres
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:
WHEELS_ENV
Current environment
development
WHEELS_DATASOURCE
Database name
Per environment
WHEELS_DEBUG
Debug mode
Per environment
Environment Detection
Order of precedence:
Command line argument
WHEELS_ENV
environment variable.wheels-env
fileDefault (
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
Never commit
.wheels-env
fileUse testing environment for tests
Match staging to production closely
Separate databases per environment
Environment-specific configuration files
Use Cases
Local Development: Switch between feature environments
Testing: Isolated test environment
Deployment: Environment-specific configurations
Debugging: Quick environment switching
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
wheels env setup - Setup new environment
wheels env list - List environments
wheels env switch - Switch environments
wheels config - Configuration management
Last updated
Was this helpful?