Command Line Tools
Wheels config diff
Wheels config diff
Section titled “Wheels config diff”Overview
Section titled “Overview”The wheels config diff command compares configuration settings and environment variables between two environments. It helps identify differences in both Wheels settings files and environment-specific .env files, making it easier to understand configuration variations across development, testing, and production environments.
Command Syntax
Section titled “Command Syntax”wheels config diff <env1> <env2> [--changesOnly] [--format=<format>] [--env] [--settings]Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| env1 | string | Yes | First environment to compare (e.g., development, testing, production) |
| env2 | string | Yes | Second environment to compare |
| —changesOnly | flag | No | Only show differences, hide identical values |
| —format | string | No | Output format: table (default) or json |
| —env | flag | No | Compare only environment variables |
| —settings | flag | No | Compare only Wheels settings |
Comparison Modes
Section titled “Comparison Modes”The command can operate in three modes:
- Both (Default) - Compares both settings and environment variables
- Environment Variables Only - Use
--envflag - Settings Only - Use
--settingsflag
Basic Usage
Section titled “Basic Usage”Compare All Configurations
Section titled “Compare All Configurations”# Compare everything between development and productionwheels config diff development productionCompare Only Differences
Section titled “Compare Only Differences”# Show only the differences, hide identical valueswheels config diff development production --changesOnlyCompare Environment Variables Only
Section titled “Compare Environment Variables Only”# Compare only .env files between environmentswheels config diff development production --envCompare Settings Only
Section titled “Compare Settings Only”# Compare only Wheels settings fileswheels config diff development production --settingsJSON Output Format
Section titled “JSON Output Format”# Output comparison as JSON for parsingwheels config diff development production --format=jsonWhat Gets Compared
Section titled “What Gets Compared”Settings Configuration
Section titled “Settings Configuration”The command compares:
- Base settings from
config/settings.cfm - Environment-specific overrides from
config/{environment}/settings.cfm - All
set()function calls are parsed and compared
Environment Variables
Section titled “Environment Variables”The command compares:
- Environment-specific files:
.env.{environment} - Falls back to
.envfor development environment if.env.developmentdoesn’t exist - All KEY=VALUE pairs are parsed with proper handling of:
- Comments (lines starting with #)
- Inline comments
- Quoted values (single or double quotes)
- Whitespace trimming
File Locations
Section titled “File Locations”Settings Files
Section titled “Settings Files”config/├── settings.cfm # Base settings├── development/│ └── settings.cfm # Development overrides├── testing/│ └── settings.cfm # Testing overrides└── production/ └── settings.cfm # Production overridesEnvironment Files
Section titled “Environment Files”project_root/├── .env # Base/development environment variables├── .env.development # Development-specific variables├── .env.testing # Testing-specific variables└── .env.production # Production-specific variablesOutput Format
Section titled “Output Format”Table Format (Default)
Section titled “Table Format (Default)”The table output is organized into clear sections:
==================================================Configuration Comparison: development vs production==================================================
ENVIRONMENT VARIABLES--------------------------------------------------
Different Values:┌──────────────────────┬────────────┬────────────┐│ Setting │ development│ production │├──────────────────────┼────────────┼────────────┤│ showDebugInformation │ true │ false ││ cacheQueries │ false │ true │└──────────────────────┴────────────┴────────────┘
Only in development:┌─────────────────┬──────────┐│ Setting │ Value │├─────────────────┼──────────┤│ debugPlugin │ true │└─────────────────┴──────────┘
Only in production:┌─────────────────┬──────────┐│ Setting │ Value │├─────────────────┼──────────┤│ forceSSL │ true │└─────────────────┴──────────┘
[ENVIRONMENT VARIABLES]
Different Values:┌──────────────┬────────────────┬────────────────┐│ Variable │ development │ production │├──────────────┼────────────────┼────────────────┤│ DB_NAME │ app_dev │ app_prod ││ DEBUG_MODE │ true │ false │└──────────────┴────────────────┴────────────────┘
================================================== SUMMARY==================================================Settings:Total: 25Identical: 20Different: 2Unique: 3
Environment Variables:Total: 15Identical: 10Different: 2Unique: 3
Overall:Total configurations: 40Identical: 30Different: 4Unique: 6Similarity: 75%JSON Format
Section titled “JSON Format”{ "ENV1": "development", "ENV2": "production", "COMPARISONS":{ "SETTINGS":{ "IDENTICAL":[...], "DIFFERENT":[...], "ONLYINSECOND":[...], "ONLYINFIRST":[...] }, "ENV": { "ONLYINSECOND":[...], "DIFFERENT":[...], "IDENTICAL":[...], "ONLYINFIRST":[...] } }, "SUMMARY": { "ENV":{ "TOTALVARIABLES":12, "ONLYINSECOND":1, "DIFFERENT":0, "IDENTICAL":0, "ONLYINFIRST":11 }, "OVERALL":{ "UNIQUE":12, "SIMILARITY":14, "DIFFERENT":0, "TOTAL":14, "IDENTICAL":2 }, "SETTINGS":{ "ONLYINSECOND":0, "TOTALSETTINGS":2, "DIFFERENT":0, "IDENTICAL":2, "ONLYINFIRST":0 } }}Security Features
Section titled “Security Features”Automatic Masking
Section titled “Automatic Masking”The command automatically masks sensitive values containing these keywords:
- password
- secret
- key
- token
- apikey/api_key
- private
- credential
- auth
- passphrase
- salt
Masked values appear as ***MASKED*** in the output.
Example
Section titled “Example”┌──────────────┬────────────────┬────────────────┐│ Variable │ development │ production │├──────────────┼────────────────┼────────────────┤│ DB_PASSWORD │ ***MASKED*** │ ***MASKED*** ││ API_KEY │ ***MASKED*** │ ***MASKED*** │└──────────────┴────────────────┴────────────────┘Common Use Cases
Section titled “Common Use Cases”Pre-Deployment Verification
Section titled “Pre-Deployment Verification”# Verify configuration differences before deploying to productionwheels config diff testing production --changesOnlyEnvironment Synchronization Check
Section titled “Environment Synchronization Check”# Check if development and testing have similar configurationswheels config diff development testingSecurity Audit
Section titled “Security Audit”# Review all security-related settings between environmentswheels config diff development production --settings | grep -i "debug\|error\|ssl"CI/CD Pipeline Integration
Section titled “CI/CD Pipeline Integration”# In your deployment scriptwheels config diff staging production --format=json > config-diff.json# Parse JSON to validate critical settings match expectationsEnvironment Variable Validation
Section titled “Environment Variable Validation”# Ensure all required environment variables exist in productionwheels config diff development production --env --changesOnlyQuick Similarity Check
Section titled “Quick Similarity Check”# Get a quick overview of configuration similaritywheels config diff development testing | grep "Similarity:"Examples
Section titled “Examples”Example 1: Basic Comparison
Section titled “Example 1: Basic Comparison”wheels config diff development productionShows all differences and similarities between development and production configurations.
Example 2: Changes Only
Section titled “Example 2: Changes Only”wheels config diff testing production --changesOnlyShows only the differences, useful for quick reviews.
Example 3: Environment Variables Focus
Section titled “Example 3: Environment Variables Focus”wheels config diff development staging --env --changesOnlyShows only environment variable differences between development and staging.
Example 4: JSON for Automation
Section titled “Example 4: JSON for Automation”wheels config diff development production --format=json | jq '.summary.overall.similarity'Outputs similarity percentage for automated checks.
Example 5: Settings Validation
Section titled “Example 5: Settings Validation”wheels config diff development production --settings --changesOnlyValidates only Wheels settings differences.
Error Handling
Section titled “Error Handling”Environment Not Found
Section titled “Environment Not Found”Warning: Settings for environment 'staging' not found!The command continues with available data and shows warnings for missing files.
No Configuration File
Section titled “No Configuration File”Warning: No settings.cfm file found in config directoryThe command will still compare environment variables if available.
Same Environment Comparison
Section titled “Same Environment Comparison”Error: Cannot compare an environment to itselfYou must specify two different environments.
Invalid Format
Section titled “Invalid Format”Error: Invalid format: xml. Valid formats are: table, jsonOnly table and json formats are supported.
Best Practices
Section titled “Best Practices”-
Regular Comparisons - Run comparisons before each deployment to catch unintended changes
-
Use changesOnly for Reviews - Focus on differences during code reviews
-
Automate with JSON - Use JSON output in CI/CD pipelines for automated validation
-
Document Differences - Keep a record of intentional differences between environments
-
Security First - Always review security-related settings (debug, error handling, SSL)
-
Version Control - Track both settings files and environment files in version control (except sensitive .env files)
- Use
--changesOnlyto quickly identify configuration drift - Pipe JSON output to
jqfor advanced filtering and processing - Create aliases for common comparisons (e.g.,
alias cfgdiff='wheels config diff') - Review the similarity percentage as a quick health check
- Use the command before and after configuration changes to verify impact
- Combine with
wheels config checkfor comprehensive configuration validation
File Format Examples
Section titled “File Format Examples”Settings File (config/production/settings.cfm)
Section titled “Settings File (config/production/settings.cfm)”<cfscript>// Production-specific settingsset(showDebugInformation = false);set(showErrorInformation = false);set(sendEmailOnError = true);set(errorEmailAddress = "admin@example.com");set(cacheQueries = true);set(forceSSL = true);</cfscript>Environment File (.env.production)
Section titled “Environment File (.env.production)”# Production Environment VariablesWHEELS_ENV=production
# Database ConfigurationDB_HOST=prod.database.comDB_PORT=3306DB_NAME=app_productionDB_USER=prod_userDB_PASSWORD=secure_password_here
# Application SettingsDEBUG_MODE=falseLOG_LEVEL=errorSESSION_TIMEOUT=30
# API KeysAPI_KEY=prod_api_key_hereSECRET_KEY=prod_secret_keyTroubleshooting
Section titled “Troubleshooting”Files Not Being Read
Section titled “Files Not Being Read”- Ensure files exist in the correct locations
- Check file permissions (must be readable)
- Verify file naming conventions (.env.{environment})
Parsing Issues
Section titled “Parsing Issues”- Check for syntax errors in settings.cfm files
- Ensure .env files use proper KEY=VALUE format
- Remove any special characters that might cause parsing errors
Missing Comparisons
Section titled “Missing Comparisons”- If using
--envor--settings, ensure you’re not filtering out the data you want - Check that both environments have the respective files
Performance Issues
Section titled “Performance Issues”- Large configuration files may take time to parse
- Consider using
--changesOnlyto reduce output - Use JSON format for faster processing in scripts
Related Commands
Section titled “Related Commands”wheels config check- Validate configuration for issueswheels get environment- Display current environmentwheels env merge- Merge environment configurationswheels env set- Set environment variables
Summary
Section titled “Summary”The wheels config diff command is an essential tool for managing multi-environment Wheels applications. It provides comprehensive comparison capabilities for both application settings and environment variables, helping teams maintain consistency and catch configuration drift before it causes issues in production.