levkk / rwf

Comprehensive framework for building web applications in Rust.
MIT License
991 stars 18 forks source link

Add .env file support #9

Open zuramai opened 1 month ago

zuramai commented 1 month ago

How to use env file instead of toml for sensitive information like credentials?

levkk commented 1 month ago

You can use crates like dotenvy (or dotenv) to load a .env file at startup, for example:

#[tokio::main]
async fn main() {
    dotenvy::dotenv().unwrap()
    /* ... */
}

Currently, rwf only supports the following env-sourced settings:

I'll add a todo on our roadmap to support configuring everything via environment variables, so you wouldn't have to use the TOML file if you didn't want to.