#env #config #load #cfg

yanked ez_cfg

Simple env config library for Rust

2 releases

0.1.1 Sep 21, 2024
0.1.0 Sep 21, 2024

#67 in #cfg

MIT license

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

~265–710KB
~17K SLoC