feat: load .env file at startup via dotenvy

This commit is contained in:
NetworkCats
2026-03-04 02:39:27 +08:00
parent 3c0be53aca
commit ab18484f58
3 changed files with 10 additions and 0 deletions
Generated
+7
View File
@@ -271,6 +271,12 @@ dependencies = [
"syn",
]
[[package]]
name = "dotenvy"
version = "0.15.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
[[package]]
name = "dunce"
version = "1.0.5"
@@ -1090,6 +1096,7 @@ dependencies = [
"arc-swap",
"askama",
"axum",
"dotenvy",
"http-body-util",
"maxminddb",
"reqwest",
+1
View File
@@ -14,6 +14,7 @@ arc-swap = "1"
reqwest = { version = "0.13", default-features = false, features = ["rustls"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
dotenvy = "0.15"
static-files = "0.3.1"
[build-dependencies]
+2
View File
@@ -7,6 +7,8 @@ use rustyip::{config, db, handlers, routes, updater};
#[tokio::main]
async fn main() {
dotenvy::dotenv().ok();
tracing_subscriber::fmt()
.with_env_filter(
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("error")),