Overview
This example demonstrates envcheck configuration for a Rust project. It validates the Rust toolchain, optional environment variables for logging and database connectivity, and required Cargo files.Configuration
.envcheck.yaml
What This Checks
Tools
- rustc >=1.65.0: Ensures you have a modern Rust compiler with the 2021 edition features
- cargo: Validates Rust’s package manager and build tool is available
Environment Variables
- RUST_LOG (optional): Controls logging verbosity for applications using
env_loggerortracing - DATABASE_URL (optional): Connection string for database access when using SQLx or Diesel
Files
- Cargo.toml: Project manifest - required for all Rust projects
- src/main.rs (optional): Binary entry point - checked for application projects
- src/lib.rs (optional): Library entry point - checked for library crates
Expected Output
Tips for Rust Projects
The configuration checks for both
src/main.rs and src/lib.rs as optional, making it suitable for both binary and library projects.Common Variations
Web API with Actix/Axum
Add web framework requirements:SQLx Database Project
Ensure SQLx compile-time checks work:Embedded/No-Std Project
Validate cross-compilation toolchain:Workspace Setup
For multi-crate workspaces:WASM Target
Validate WebAssembly toolchain:Rust-Specific Considerations
Logging Levels
RUST_LOG accepts various formats:- Simple:
info,debug,trace - Module-specific:
my_crate=debug,hyper=info - Complex filters:
warn,my_crate::module=trace
Database URL Format
Common DATABASE_URL patterns:- PostgreSQL:
postgres://user:pass@localhost/db - MySQL:
mysql://user:pass@localhost/db - SQLite:
sqlite://path/to/db.sqliteorsqlite::memory:
Cargo Configuration
Consider checking.cargo/config.toml for projects with custom build configurations, target specifications, or registry settings.
Learn More
- Tools Validator - Rust toolchain and cargo tools
- Environment Variables - Runtime configuration
- File Validator - Project structure validation
- Port Checker - Service port management
