Dot Env Config

use .env as config file and parse environments to config struct.

Usage

derive EnvConfig

```rust use dotenv::dotenv; use dotenv_config::EnvConfig;

[derive(Debug, EnvConfig)]

struct Config { #[envconfig(default = "192.168.2.1")] serveraddr: String, servermode: bool, #[envconfig(name = "ZINCFOO", default = true)] foo: bool, #[envconfig(name = "ZINC_BAR", default = 123456)] bar: Option, }

fn main() { dotenv().ok(); let cfg = Config::init().unwrap(); println!("{:#?}", cfg); } ```

attribute env_config

you can use macro attribute set field attribute

you can though system environments or .env file config it.

ZINC_FOO=false ZINC_BAR=8787878

default load environment key is: structName_fieldName do UpperSnake, like above struct, default config key is:

CONFIG_SERVER_ADDR CONFIG_SERVER_MODE ZINC_FOO ZINC_BAR