Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .env file support #9

Open
zuramai opened this issue Oct 26, 2024 · 1 comment
Open

Add .env file support #9

zuramai opened this issue Oct 26, 2024 · 1 comment
Labels
v1 Features desired for v1.0 release

Comments

@zuramai
Copy link

zuramai commented Oct 26, 2024

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

@levkk
Copy link
Owner

levkk commented Oct 26, 2024

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 localhost
  • RWF_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 executing

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.

@levkk levkk added the v1 Features desired for v1.0 release label Nov 18, 2024
@levkk levkk added this to Road to v1 Nov 18, 2024
@levkk levkk changed the title using .env file Add .env file support Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1 Features desired for v1.0 release
Projects
Status: No status
Development

No branches or pull requests

2 participants