2 releases
0.1.1 | Sep 21, 2024 |
---|---|
0.1.0 | Sep 21, 2024 |
#78 in #cfg
3KB
ez_config: Simple env config library for Rust
Overview
Ez_config allows to load config from env variables or .env
file.
Example
use ez_config::*;
#[derive(Config)]
struct MyConfig {
token: String,
debug_mode: bool,
some_numeber: i32
}
fn main() {
// load config from env
let my_config = MyConfig::load();
// rest of the program
}
In .env file
TOKEN="my_secret_token"
DEBUG_MODE=false
SOME_NUMBER=123
lib.rs
:
ez_cfg: Simple env config library for Rust
Overview
Ez_config allows to load config from env variables or .env
file.
Example
use ez_cfg::*;
#[derive(Config)]
struct MyConfig {
token: String,
debug_mode: bool,
some_numeber: i32
}
fn main() {
// load config from env
let my_config = MyConfig::load();
// rest of the program
}
In .env file
TOKEN="my_secret_token"
DEBUG_MODE=false
SOME_NUMBER=123
Dependencies
~260–700KB
~17K SLoC