| Crates.io | confers |
| lib.rs | confers |
| version | 0.2.2 |
| created_at | 2025-12-27 11:28:02.161464+00 |
| updated_at | 2026-01-25 08:08:56.448075+00 |
| description | A modern, type-safe configuration management library with validation, diff, and hot-reload support |
| homepage | https://github.com/Kirky-X/confers |
| repository | https://github.com/Kirky-X/confers |
| max_upload_size | |
| id | 2007068 |
| size | 1,074,356 |
A modern, type-safe configuration management library for Rust
β¨ Features β’ π Quick Start β’ π Documentation β’ π» Examples β’ π€ Contributing
Confers provides a declarative approach to configuration management with:
| β¨ Type Safety | π Auto Reload | π AES-256 Encryption | π Remote Sources |
|---|---|---|---|
| Compile-time checks | Hot reload support | Sensitive data protection | etcd, Consul, HTTP |
use confers::Config;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, Config)]
#[config(validate)]
pub struct AppConfig {
pub name: String,
pub port: u16,
pub debug: bool,
}
// Configuration loads automatically from files, env vars, and CLI args
let config = AppConfig::load()?;
| π― Core Features | β‘ Optional Features |
|---|---|
| Always available | Enable as needed |
π― Core Features (Always Available)
|
β‘ Optional Features
|
| Preset | Features | Use Case |
|---|---|---|
| minimal | derive |
Minimal config loading (no validation, no CLI) |
| recommended | derive, validation |
Recommended for most applications |
| dev | derive, validation, cli, schema, audit, monitoring, tracing |
Development with all tools |
| production | derive, validation, watch, encryption, remote, monitoring, tracing |
Production-ready configuration |
| full | All features | Complete feature set |
Note: The cli feature automatically includes derive, validation, and encryption dependencies.
graph LR
A[<b>Configuration Sources</b><br/>π Files β’ π Env β’ π» CLI] --> B[<b>ConfigLoader</b><br/>π§ Core Engine]
B --> C[<b>Validation</b><br/>β
Type & Business Rules]
B --> D[<b>Schema</b><br/>π JSON Schema Gen]
B --> E[<b>Encryption</b><br/>π AES-256-GCM]
B --> F[<b>Audit</b><br/>π Access Logs]
B --> G[<b>Monitoring</b><br/>π Memory Watch]
C --> H[<b>Application Config</b><br/>π Ready to Use]
D --> H
E --> H
F --> H
G --> H
style A fill:#DBEAFE,stroke:#1E40AF,stroke-width:2px
style B fill:#FEF3C7,stroke:#92400E,stroke-width:2px
style H fill:#DCFCE7,stroke:#166534,stroke-width:2px
π¦ Rust Installation
Individual Features:
π§ CLI Command Feature Dependencies
Note: The |
Required Features: derive, validation (use: features = ["recommended"])
|
Step 1: Define Config Structure
|
Step 2: Create Config File
|
|
Step 3: Load Config
|
Step 4: Environment Override
|
use confers::Config;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, Config)]
#[config(validate)]
#[config(env_prefix = "APP_")]
pub struct AppConfig {
pub name: String,
pub port: u16,
pub debug: bool,
}
fn main() -> anyhow::Result<()> {
// Create config file
let config_content = r#"
name = "my-app"
port = 8080
debug = true
"#;
std::fs::write("config.toml", config_content)?;
// Load configuration
let config = AppConfig::load()?;
// Print configuration
println!("π Configuration loaded successfully!");
println!("π Name: {}", config.name);
println!("π Port: {}", config.port);
println!("π Debug: {}", config.debug);
Ok(())
}
|
User Guide Complete usage guide |
API Reference Complete API docs |
Examples Code examples |
| Resource | Description |
|---|---|
| β FAQ | Frequently asked questions |
| π Contributing Guide | Code contribution guidelines |
| π API Reference | Complete API documentation |
| ποΈ Architecture Decisions | ADR documentation |
| π Library Integration Guide | How to integrate confers CLI into your projects |
Confers provides a unified ConfersCli API for easy integration into other Rust projects.
[dependencies]
confers = { version = "0.2.2", features = ["cli"] }
use confers::ConfersCli;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Generate configuration template
ConfersCli::generate(Some("config.toml"), "full")?;
// Validate configuration
ConfersCli::validate("config.toml", "full")?;
// Compare configurations
ConfersCli::diff("config1.toml", "config2.toml", Some("unified"))?;
// Encrypt values
let encrypted = ConfersCli::encrypt("secret", None)?;
Ok(())
}
| Method | Description | Example |
|---|---|---|
generate(output, level) |
Generate config templates | ConfersCli::generate(Some("app.toml"), "minimal")? |
validate(config, level) |
Validate config files | ConfersCli::validate("app.toml", "full")? |
diff(file1, file2, format) |
Compare configs | ConfersCli::diff("old.toml", "new.toml", Some("side-by-side"))? |
encrypt(value, key) |
Encrypt values | ConfersCli::encrypt("secret", None)? |
wizard(non_interactive) |
Interactive setup | ConfersCli::wizard(false)? |
completions(shell) |
Generate completions | ConfersCli::completions("bash")? |
key(subcommand) |
Key management | ConfersCli::key(&KeySubcommand::Generate)? |
π Complete Integration Guide β
π Example 1: Basic Configuration
View Output
|
π₯ Example 2: Advanced Configuration
View Output
|
graph TB
subgraph Sources ["π₯ Configuration Sources"]
A[π Local Files<br/>TOML, JSON, YAML, INI]
B[π Environment Variables]
C[π» CLI Arguments]
D[βοΈ Remote Sources<br/>etcd, Consul, HTTP]
end
subgraph Core ["π§ Core Engine"]
E[β‘ ConfigLoader<br/>Multi-source Merge]
end
subgraph Processing ["π¨ Processing Layer"]
F[β
Validation<br/>Type & Business Rules]
G[π Schema Generation]
H[π Encryption<br/>AES-256-GCM]
I[π Audit Logging]
J[ποΈ File Watching]
K[π Memory Monitoring]
end
subgraph Output ["π€ Application"]
L[π Application Configuration<br/>Type-Safe & Validated]
end
Sources --> Core
Core --> Processing
Processing --> Output
style Sources fill:#DBEAFE,stroke:#1E40AF
style Core fill:#FEF3C7,stroke:#92400E
style Processing fill:#EDE9FE,stroke:#5B21B6
style Output fill:#DCFCE7,stroke:#166534
| Component | Description | Status |
|---|---|---|
| ConfigLoader | Core loader with multi-source support | β Stable |
| Configuration Validation | Built-in validator integration | β Stable |
| Schema Generation | Auto-generate JSON Schema | β Stable |
| File Watching | Real-time monitoring with hot reload | β Stable |
| Remote Configuration | etcd, Consul, HTTP support | π§ Beta |
| Audit Logging | Record access and change history | β Stable |
| Encrypted Storage | AES-256 encrypted storage | β Stable |
| Configuration Diff | Multiple output formats | β Stable |
| Interactive Wizard | Template generation | β Stable |
|
Basic Configuration
|
Advanced Configuration
|
| Option | Type | Default | Description |
|---|---|---|---|
name |
String | - | Project name |
version |
String | "1.0.0" | Version number |
host |
String | "localhost" | Server host |
port |
u16 | 8080 | Server port |
debug |
Boolean | false | Enable debug mode |
workers |
usize | 4 | Number of worker threads |
cache_size |
usize | 1000 | Cache size in MB |
# π§ͺ Run all tests
cargo test --all-features
# π Generate coverage report
cargo tarpaulin --out Html
# β‘ Run benchmarks
cargo bench
# π― Run specific test
cargo test test_name
| Category | Test Count | Coverage |
|---|---|---|
| π§ͺ Unit Tests | 50+ | 85% |
| π Integration Tests | 20+ | 80% |
| β‘ Performance Tests | 10+ | 75% |
| π Total | 80+ | 80% |
|
π Throughput
|
β±οΈ Latency
|
# Run benchmarks
cargo bench
# Sample output:
test bench_config_load ... bench: 1,000 ns/iter (+/- 50)
test bench_validate ... bench: 2,000 ns/iter (+/- 100)
test bench_schema_gen ... bench: 500 ns/iter (+/- 25)
|
Memory Safety Zero-copy & secure cleanup |
Audited Regular security audits |
Privacy No data collection |
Compliance Industry standards |
| Measure | Description | API Reference |
|---|---|---|
| β Memory Protection | Automatic secure cleanup with zeroization | SecureString, zeroize crate |
| β Side-channel Protection | Constant-time cryptographic operations | AES-256-GCM encryption |
| β Input Validation | Comprehensive input sanitization | ConfigValidator, InputValidator |
| β Audit Logging | Full operation tracking | AuditConfig, audit trails |
| β SSRF Protection | Server-Side Request Forgery prevention | validate_remote_url() |
| β Sensitive Data Detection | Automatic detection of sensitive fields | SensitiveDataDetector |
| β Error Sanitization | Remove sensitive info from error messages | ErrorSanitizer, SecureLogger |
| β Nonce Reuse Detection | Prevent cryptographic nonce reuse | Built into encryption module |
// Secure string handling
use confers::security::{SecureString, SensitivityLevel};
let secure_str = SecureString::new("sensitive_data", SensitivityLevel::High);
// Input validation
use confers::security::ConfigValidator;
let validator = ConfigValidator::new();
let result = validator.validate_input(user_input);
// Error sanitization
use confers::security::ErrorSanitizer;
let sanitizer = ErrorSanitizer::default();
let safe_error = sanitizer.sanitize(&error_message);
// Audit logging
#[cfg(feature = "audit")]
use confers::audit::AuditConfig;
let audit = AuditConfig::new().enable_sensitive_field_tracking();
encryption feature for sensitive configsPlease report security vulnerabilities to: security@confers.example
gantt
title Confers Development Roadmap
dateFormat YYYY-MM
section Core Features β
Type-safe Configuration :done, 2024-01, 2024-06
Multi-format Support :done, 2024-02, 2024-06
Environment Variable Override :done, 2024-03, 2024-06
section Validation System β
Basic Validation Integration :done, 2024-04, 2024-07
Parallel Validation Support :done, 2024-05, 2024-08
section Advanced Features π§
Schema Generation :active, 2024-06, 2024-09
File Watching Hot Reload :done, 2024-07, 2024-09
Remote Configuration Support :active, 2024-08, 2024-12
Audit Logging :done, 2024-08, 2024-10
β Completed
|
π Planned
|
π Report BugsFound an issue? |
π‘ Feature SuggestionsHave a great idea? |
π§ Submit PRWant to contribute code? |
git clone https://github.com/yourusername/confers.gitgit checkout -b feature/amazing-featurecargo test --all-featuresgit commit -m 'feat: Add amazing feature'git push origin feature/amazing-featurecargo clippy -- -D warnings|
Rust |
GitHub |
Open Source |
Community |
| Category | Description |
|---|---|
| π Dependency Projects | serde - Serialization framework |
| figment - Configuration management | |
| validator - Validation library | |
| π₯ Contributors | Thanks to all contributors! |
| π¬ Community | Special thanks to community members |
|
Issues Report bugs & issues |
Discussions Ask questions & share ideas |
GitHub View source code |
If you find this project useful, please consider giving it a βοΈ!
Built with β€οΈ by Kirky.X
Β© 2026 Kirky.X. All rights reserved.