Command Line Tools
Wheels config check
Wheels config check
Section titled “Wheels config check”Overview
Section titled “Overview”The wheels config check command validates your Wheels application configuration settings across different environments. It performs comprehensive checks on security settings, database configuration, environment-specific settings, and more, helping you identify potential issues before deployment.
Command Syntax
Section titled “Command Syntax”wheels config check [environment] [--verbose] [--fix]Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| environment | string | No | The environment to check (development, testing, production). If not specified, detects from current configuration |
| —verbose | flag | No | Show detailed validation information including fix suggestions |
| —fix | flag | No | Attempt to automatically fix certain issues |
Basic Usage
Section titled “Basic Usage”Check Current Environment
Section titled “Check Current Environment”wheels config checkCheck Specific Environment
Section titled “Check Specific Environment”wheels config check productionCheck with Detailed Output
Section titled “Check with Detailed Output”wheels config check --verboseAuto-fix Issues
Section titled “Auto-fix Issues”wheels config check --fixCombined Options
Section titled “Combined Options”wheels config check production --verbose --fixWhat Gets Checked
Section titled “What Gets Checked”The command performs validation across multiple configuration areas:
1. Configuration Files
Section titled “1. Configuration Files”- Verifies existence of
config/settings.cfm - Checks for environment-specific settings files
- Validates file structure and syntax
2. Required Settings
Section titled “2. Required Settings”- Datasource Configuration: Ensures a datasource is configured
- Core Settings: Validates essential Wheels configuration parameters
3. Security Configuration
Section titled “3. Security Configuration”- Sensitive Values: Detects hardcoded passwords, API keys, tokens
- Debug Mode: Ensures debug is disabled in production
- Error Emails: Checks error notification setup for production
- Reload Password: Validates reload password strength
- SSL/HTTPS: Verifies SSL enforcement in production
- Session Security: Checks session timeout settings
- Error Information: Ensures error details are hidden in production
4. Database Configuration
Section titled “4. Database Configuration”- Datasource Validity: Verifies datasource exists and is accessible
- Migration Settings: Checks auto-migration configuration
- Connection Settings: Validates database connection parameters
5. Environment Settings
Section titled “5. Environment Settings”- Environment Directory: Checks for environment-specific config directories
- Caching Configuration: Validates cache settings for production
- Performance Settings: Reviews optimization configurations
6. .env File Configuration
Section titled “6. .env File Configuration”- File Existence: Checks for .env file presence
- File Permissions: Validates security permissions
- Git Ignore: Ensures .env is in .gitignore
- Environment Variables: Verifies WHEELS_ENV or Environment variable
7. Production-Specific (when checking production)
Section titled “7. Production-Specific (when checking production)”- SSL Enforcement: Validates forceSSL setting
- Session Management: Reviews session timeout configuration
- Error Handling: Ensures proper error information hiding
- Cache Settings: Verifies all caching is enabled
Output Format
Section titled “Output Format”The command provides real-time status as it performs checks:
==================================================Configuration Validation - development Environment==================================================
[SUCCESS]: Files Configuration[SUCCESS]: Required Settings[SUCCESS]: Security Configuration[SUCCESS]: Database Configuration[SUCCESS]: Environment-Specific Settings[FAILED]: .env File Configuration
--------------------------------------------------
[ERRORS] (1): - .env file not in .gitignore
--------------------------------------------------[FAILED] Configuration check failed Found: 1 error
Tip: Run with --verbose flag for detailed fix suggestionsStatus Indicators
Section titled “Status Indicators”- [SUCCESS] - Check passed successfully
- [WARNING] - Non-critical issues found
- [FAILED] - Critical errors detected
- [FIXED] - Issue was automatically fixed
Results Display
Section titled “Results Display”Error Output
Section titled “Error Output”[ERRORS] (2): - Missing config/settings.cfm file - Datasource 'myapp_db' not foundWarning Output
Section titled “Warning Output”[WARNINGS] (3): - Possible hardcoded sensitive value in 'apiKey' - No environment-specific config directory for 'production' - Automatic database migration is enabledFixed Issues Output
Section titled “Fixed Issues Output”[FIXED] Issues: - Created sample .env file - Added .env to .gitignoreSummary Output
Section titled “Summary Output”[SUCCESS] Configuration validation successful! All checks completed successfully.Or with issues:
[FAILED] Configuration check failed Found: 2 errors, 3 warnings
Tip: Run with --verbose flag for detailed fix suggestionsVerbose Mode
Section titled “Verbose Mode”When using --verbose, each issue includes detailed fix suggestions:
wheels config check --verboseOutput:
[ERRORS] (1): - Debug mode is enabled in production --> Fix: Set showDebugInformation = false in config/production/settings.cfmAuto-Fix Feature
Section titled “Auto-Fix Feature”The --fix flag attempts to automatically resolve certain issues:
What Can Be Auto-Fixed
Section titled “What Can Be Auto-Fixed”- Create sample .env file if missing
- Add .env to .gitignore
- Create basic configuration templates
- Set default secure values
Example
Section titled “Example”wheels config check --fixOutput:
[FIXED] Issues: - Created sample .env file - Added .env to .gitignoreEnvironment Detection
Section titled “Environment Detection”The command detects the current environment in the following priority:
- Command parameter (if specified)
- WHEELS_ENV in .env file
- Environment in .env file
- WHEELS_ENV system environment variable
- Environment system environment variable
- Default to ‘development’
Common Use Cases
Section titled “Common Use Cases”Pre-Deployment Check
Section titled “Pre-Deployment Check”# Check production configuration before deploymentwheels config check production --verboseDevelopment Setup Validation
Section titled “Development Setup Validation”# Ensure development environment is properly configuredwheels config check development --fixCI/CD Pipeline Integration
Section titled “CI/CD Pipeline Integration”# In your CI/CD scriptwheels config check productionif [ $? -ne 0 ]; then echo "Configuration validation failed!" exit 1fiSecurity Audit
Section titled “Security Audit”# Check for security issues across all environmentswheels config check development --verbosewheels config check testing --verbosewheels config check production --verboseExit Codes
Section titled “Exit Codes”The command returns different exit codes for scripting:
- 0 - All checks passed (may have warnings)
- 1 - One or more errors found
Best Practices
Section titled “Best Practices”-
Run Before Deployment - Always validate production configuration before deploying
-
Use in CI/CD - Include configuration checks in your automated pipelines
-
Regular Audits - Periodically check all environments for security issues
-
Fix Warnings - While warnings don’t fail the check, addressing them improves security and performance
-
Version Control - After using
--fix, review and commit the changes -
Environment-Specific Configs - Create separate configuration directories for each environment
Troubleshooting
Section titled “Troubleshooting”Command Not Found
Section titled “Command Not Found”Error: This command must be run from a Wheels application directorySolution: Run the command from your Wheels application root directory
Cannot Read Configuration
Section titled “Cannot Read Configuration”Error reading configuration: [error message]Solution: Check file permissions and ensure configuration files are valid CFML
Datasource Not Found
Section titled “Datasource Not Found”Datasource 'myapp_db' not foundSolution: Configure the datasource in your CFML administrator or Application.cfc
Permission Issues with .env
Section titled “Permission Issues with .env”.env file has overly permissive permissionsSolution: Run chmod 600 .env to restrict file permissions
Configuration File Examples
Section titled “Configuration File Examples”Basic config/settings.cfm
Section titled “Basic config/settings.cfm”<cfscript>// Application settingsset(dataSourceName = application.env["DB_NAME"]);set(reloadPassword = application.env["RELOAD_PASSWORD"]);
// Security settingsset(showDebugInformation = false);set(showErrorInformation = false);
// Performance settingsset(cacheQueries = true);set(cachePartials = true);</cfscript>Environment-specific config/production/settings.cfm
Section titled “Environment-specific config/production/settings.cfm”<cfscript>// Production overridesset(showDebugInformation = false);set(sendEmailOnError = true);set(errorEmailAddress = "admin@example.com");set(forceSSL = true);
// Enable all cachingset(cacheControllerConfig = true);set(cacheDatabaseSchema = true);set(cacheFileChecking = true);set(cacheImages = true);set(cacheModelConfig = true);set(cachePartials = true);set(cacheQueries = true);set(cacheRoutes = true);</cfscript>Sample .env file
Section titled “Sample .env file”# Wheels Environment ConfigurationWHEELS_ENV=development
# Database ConfigurationDB_HOST=localhostDB_PORT=3306DB_NAME=myapp_developmentDB_USER=dbuserDB_PASSWORD=secure_password
# Application SettingsRELOAD_PASSWORD=change_this_passwordSECRET_KEY=your_secret_key_hereAPI_KEY=your_api_keyRelated Commands
Section titled “Related Commands”wheels get environment- Display current environment settingwheels env merge- Merge environment configurationswheels db create- Create database for current environmentwheels test- Run tests in current environment
Security Considerations
Section titled “Security Considerations”- Never commit .env files - Always keep .env in .gitignore
- Use environment variables - Don’t hardcode sensitive values
- Restrict file permissions - Set appropriate permissions on configuration files
- Different passwords per environment - Use unique credentials for each environment
- Enable SSL in production - Always force SSL for production environments
- Hide error details - Never show debug information in production
- Run with
--verbosefirst to understand all issues before using--fix - Create environment-specific directories even if empty for better organization
- Use the command as part of your deployment checklist
- Keep configuration files well-commented for team members
- Regularly update and review security settings
- Use strong, unique reload passwords for each environment
- Document any custom configuration requirements for your team