Open zuramai opened 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:
RWF_DATABASE_URL
which will configure the connection pool to use that database, e.g. postgres://localhost:5432/postgres
RWF_DATABASE_USER
if you only want to configure which user to connect with, everything else defaults to localhostRWF_DATABASE_NAME
same as USER
except it overrides the database name, again only localhost connections; for anything else, use RWF_DATABASE_URL
RWF_LOG_QUERIES
set this to any value to enable the ORM to log what queries it's executingI'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.
How to use env file instead of toml for sensitive information like credentials?