levkk / rwf

Comprehensive framework for building web applications in Rust.
MIT License
948 stars 16 forks source link

using .env file #9

Open zuramai opened 1 week ago

zuramai commented 1 week ago

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

levkk commented 1 week 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.