Crates.io | dotconf |
lib.rs | dotconf |
version | 0.1.3 |
created_at | 2025-08-13 10:54:00.151309+00 |
updated_at | 2025-08-14 06:02:19.012062+00 |
description | A very light-weight dotenv crate |
homepage | https://github.com/devfans/dotconf-rs |
repository | https://github.com/devfans/dotconf-rs |
max_upload_size | |
id | 1793533 |
size | 9,695 |
With less than 20 lines of code of the core part, but meet most of the requirements of a dotenv. JUST KEEP IT SIMPLE!
Sample .env
file:
a = hi # This is a comment
b = -123
c = false
use dotconf::{init, init_with_path};
init().ok() // Ignore the error even if `.env` does not exist.
init().expect("Failed to load env conf file (default: .env)");
init_with_path(".dotenvfile").expect("Failed to load from the specified env conf file");
// Read value with env::var with some simple type conversions
let a = dotconf::var("a").to_string().unwrap();
let b = dotconf::var("b").to_isize().unwrap();
let c = dotconf::var("c").to_bool().unwrap();