Expand description
§Reinhardt Configuration Framework
Django-inspired settings management for Rust with secrets, encryption, and audit logging.
This crate provides a comprehensive configuration management framework for Reinhardt applications, inspired by Django’s settings system with additional security features.
§Features
- Multiple configuration sources: Files, environment variables, command-line arguments
- Type-safe settings: Strong type validation with custom validators
- Secrets management: Integration with HashiCorp Vault, AWS Secrets Manager, Azure Key Vault
- Encryption: Built-in encryption for sensitive settings
- Dynamic backends: Redis and database-backed dynamic settings
- Secret rotation: Automatic secret rotation support
- Audit logging: Track all setting changes
§Quick Start
use reinhardt_conf::Settings;
// Create settings with defaults and override specific fields
#[allow(deprecated)]
let mut settings = Settings::default();
settings.core.secret_key = "my-secret-key".to_string();
settings.core.debug = false;
settings.core.allowed_hosts = vec!["example.com".to_string()];
assert!(!settings.core.debug);
assert_eq!(settings.core.allowed_hosts[0], "example.com");§Architecture
Key modules in this crate:
settings: Core settings management with layered configuration and builder patternbuilder:SettingsBuilderfor composing config from multiple sourcessources: Configuration source adapters (files, env vars,.envfiles)profile: Environment profiles (Development, Staging, Production)dynamic: Redis and database-backed dynamic settingssecrets: Secrets management integration (Vault, AWS, Azure)encryption: AES-GCM encryption for sensitive settings valuesaudit: Change tracking and audit log for setting modificationshot_reload: File system watcher for live settings reload
§Feature Flags
| Feature | Default | Description |
|---|---|---|
settings | enabled | Core settings management and builder |
async | disabled | Async/await support via Tokio |
dynamic-redis | disabled | Redis-backed dynamic settings |
dynamic-database | disabled | Database-backed dynamic settings |
vault | disabled | HashiCorp Vault secrets integration |
aws-secrets | disabled | AWS Secrets Manager integration |
azure-keyvault | disabled | Azure Key Vault integration |
secret-rotation | disabled | Automatic secret rotation support |
encryption | disabled | AES-GCM encryption for sensitive values |
hot-reload | disabled | Live settings reload on file change |
caching | disabled | In-memory settings caching with TTL |
Re-exports§
pub use settings::DatabaseConfig;pub use settings::MiddlewareConfig;pub use settings::Settings;Deprecated pub use settings::TemplateConfig;pub use settings::cache::CacheSettings;pub use settings::cache::HasCacheSettings;pub use settings::contacts::ContactSettings;pub use settings::contacts::HasContactSettings;pub use settings::core_settings::CoreSettings;pub use settings::core_settings::HasCoreSettings;pub use settings::cors::CorsSettings;pub use settings::cors::HasCorsSettings;pub use settings::email::EmailSettings;pub use settings::email::HasEmailSettings;pub use settings::fragment::HasSettings;pub use settings::fragment::SettingsFragment;pub use settings::i18n::HasI18nSettings;pub use settings::i18n::I18nSettings;pub use settings::logging::HasLoggingSettings;pub use settings::logging::LoggingSettings;pub use settings::media::HasMediaSettings;pub use settings::media::MediaSettings;pub use settings::security::HasSecuritySettings;pub use settings::security::SecuritySettings;pub use settings::session::HasSessionSettings;pub use settings::session::SessionSettings;pub use settings::static_files::HasStaticSettings;pub use settings::static_files::StaticSettings;pub use settings::template_settings::HasTemplateSettings;pub use settings::template_settings::TemplateSettings;
Modules§
- settings
- Settings Module
Macros§
- assert_
env - Assert that an environment variable has a specific value
- assert_
env_ exists - Assert that an environment variable exists
- assert_
env_ not_ exists - Assert that an environment variable does not exist