From 95dc6ebd619b06e20d26f010406341c0073b9aaf Mon Sep 17 00:00:00 2001 From: 0xf8 <0xf8.dev@proton.me> Date: Wed, 21 Jun 2023 15:31:31 -0400 Subject: [PATCH] Add dotenvy --- Cargo.toml | 1 + src/main.rs | 3 +++ src/main_dbtool.rs | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f6b5ca3..65c9ff2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,7 @@ base64 = "0.21.2" bcrypt = "0.14.0" colored = "2.0.0" dialoguer = { version = "0.10.4", default-features = false, features = ["password"] } +dotenvy = "0.15.7" driftwood = "0.0.7" femme = "2.2.1" futures = "0.3.28" diff --git a/src/main.rs b/src/main.rs index 55ac23e..012ab4b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,6 +12,7 @@ #![feature(fs_try_exists)] use anyhow::{bail, Result}; +use dotenvy::dotenv; use log::{info, warn}; use log::LevelFilter::Debug; @@ -21,6 +22,8 @@ mod server; #[async_std::main] async fn main() -> Result<()> { + let _ = dotenv(); + // Early catch if std::env::var("DATABASE_URL").is_err() { bail!("DATABASE_URL needs to be set.") diff --git a/src/main_dbtool.rs b/src/main_dbtool.rs index 48cf605..e7ae211 100644 --- a/src/main_dbtool.rs +++ b/src/main_dbtool.rs @@ -12,7 +12,8 @@ #![feature(fs_try_exists)] use anyhow::{bail, Result}; -use log::{debug, error, info, log, trace, warn}; +use dotenvy::dotenv; +use log::error; use log::LevelFilter::{Debug, Info}; use yggdrasil::*; @@ -22,6 +23,8 @@ mod dbtool; #[async_std::main] async fn main() -> Result<()> { + let _ = dotenv(); + // Early catch if std::env::var("DATABASE_URL").is_err() { bail!("DATABASE_URL needs to be set.")