Genies Derive
A powerful derive macro for configuration management in Rust, providing a flexible and type-safe way to handle application configurations.
Features
- 🔧 Default values via attributes
- 🌍 Environment variable support
- ✅ Configuration validation
- 📁 YAML file configuration
- 🔄 Hot reloading support
- 🏗️ Builder pattern
- 🔄 Type conversion
- 📦 Array and Option type support
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Quick Start
use Config;
use ;
async
Configuration Sources
Configurations are loaded in the following priority order (highest first):
- Environment variables
- Configuration file
- Default values
- None (for optional fields)
Environment Variables
Field names are automatically converted to SCREAMING_SNAKE_CASE:
YAML Configuration
host: "example.com"
port: 8080
topics:
- "topic1"
- "topic2"
username: "user"
timeout_seconds: 60
Features
Default Values
host: String
Validation
port: u16
Arrays
topics:
Optional Fields
username:
Hot Reloading
let mut config = from_sources?;
config.reload.await?;
Examples
Check out the examples directory for more detailed examples.
Contributing
We welcome contributions! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.