sanar-idk 0.1.1

Initialize Default Keys - A Rust macro to generate config structs from environment variables easily
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use sanar_idk::create_config_struct;

create_config_struct! {
    #[derive(Debug, Clone)]
    pub struct Config {
        pub port: u16 => "PORT", @default 8000,
        pub db_url: String => "DATABASE_URL", @expect "DATABASE_URL must be set"
    }
}

fn main() {
    let port = &DEFAULT.port; // 8000
    let db_url = &DEFAULT.db_url; // panic!

    println!("port: {} - db_url: {}", port, db_url);
}