| Crates.io | armature-config |
| lib.rs | armature-config |
| version | 0.1.1 |
| created_at | 2025-12-26 20:53:59.928147+00 |
| updated_at | 2025-12-29 00:47:31.155871+00 |
| description | Configuration management for Armature with environment and file support |
| homepage | https://pegasusheavy.github.io/armature |
| repository | https://github.com/pegasusheavy/armature |
| max_upload_size | |
| id | 2006231 |
| size | 91,335 |
Configuration management for the Armature framework.
[dependencies]
armature-config = "0.1"
use armature_config::{Config, Environment};
use serde::Deserialize;
#[derive(Deserialize)]
struct AppConfig {
database_url: String,
port: u16,
debug: bool,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let config: AppConfig = Config::builder()
.add_source(Environment::with_prefix("APP"))
.add_source(File::with_name("config"))
.build()?
.try_deserialize()?;
println!("Port: {}", config.port);
Ok(())
}
APP_DATABASE_URL=postgres://localhost/mydb
APP_PORT=3000
APP_DEBUG=true
# config.toml
database_url = "postgres://localhost/mydb"
port = 3000
debug = true
MIT OR Apache-2.0