mirror of
https://github.com/darwincereska/envkit.git
synced 2026-06-11 10:23:23 -05:00
feat: added examples
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
use envkit::EnvLoader;
|
||||
|
||||
fn main() -> Result<(), envkit::error::EnvError> {
|
||||
let loader = EnvLoader;
|
||||
let app = loader.with_prefix("APP_");
|
||||
|
||||
let host: String = app.get("HOST")?;
|
||||
let port: u16 = app.get_or("PORT", 8080);
|
||||
let enabled: bool = app.get_or("ENABLED", false);
|
||||
|
||||
println!("host={host}");
|
||||
println!("port={port}");
|
||||
println!("enabled={enabled}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user