From 6aca94ae5c3a6513ffded1976ddab6ab38c2face Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Fri, 27 Feb 2026 17:47:14 +0900 Subject: [PATCH] chore: replace dotenvy with dotenvor --- .cspell.yml | 2 +- Cargo.lock | 26 +++++++++++++++---------- Cargo.toml | 2 +- auth/simple-auth-server/Cargo.toml | 2 +- auth/simple-auth-server/README.md | 2 +- auth/simple-auth-server/src/main.rs | 2 +- background-jobs/Cargo.toml | 2 +- background-jobs/src/main.rs | 2 +- basics/todo/Cargo.toml | 2 +- basics/todo/src/main.rs | 4 ++-- databases/diesel-async/Cargo.toml | 2 +- databases/diesel-async/src/main.rs | 6 +++--- databases/diesel/Cargo.toml | 2 +- databases/diesel/src/main.rs | 4 ++-- databases/mysql/Cargo.toml | 2 +- databases/mysql/src/main.rs | 2 +- databases/postgres/Cargo.toml | 2 +- databases/postgres/README.md | 2 +- databases/postgres/src/main.rs | 4 ++-- forms/multipart-s3/Cargo.toml | 2 +- forms/multipart-s3/src/main.rs | 4 ++-- graphql/juniper-advanced/Cargo.toml | 2 +- graphql/juniper-advanced/src/main.rs | 2 +- tracing/mainmatter-workshop/Cargo.toml | 2 +- tracing/mainmatter-workshop/src/main.rs | 2 +- 25 files changed, 46 insertions(+), 40 deletions(-) diff --git a/.cspell.yml b/.cspell.yml index f92f8ff8..8459e6fe 100644 --- a/.cspell.yml +++ b/.cspell.yml @@ -12,7 +12,7 @@ words: - clippy - deadpool - dotenv - - dotenvy + - dotenvor - graphiql - mainmatter - minijinja diff --git a/Cargo.lock b/Cargo.lock index 3c55b9a4..4056ba8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1601,7 +1601,7 @@ dependencies = [ "apalis-redis", "chrono", "color-eyre", - "dotenvy", + "dotenvor", "env_logger", "eyre", "log", @@ -2625,7 +2625,7 @@ version = "0.0.0" dependencies = [ "actix-web", "diesel", - "dotenvy", + "dotenvor", "env_logger", "log", "serde", @@ -2639,7 +2639,7 @@ dependencies = [ "actix-web", "diesel", "diesel-async", - "dotenvy", + "dotenvor", "env_logger", "log", "serde", @@ -2663,7 +2663,7 @@ dependencies = [ "confik", "deadpool-postgres", "derive_more 2.0.1", - "dotenvy", + "dotenvor", "serde", "tokio-pg-mapper", "tokio-pg-mapper-derive", @@ -2922,6 +2922,12 @@ dependencies = [ "log", ] +[[package]] +name = "dotenvor" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f48f26ebd931c54a0e1e315b8ae0cb476ad18a29e68a44f4dd0bf5306911307" + [[package]] name = "dotenvy" version = "0.15.7" @@ -4678,7 +4684,7 @@ version = "0.0.0" dependencies = [ "actix-cors", "actix-web", - "dotenvy", + "dotenvor", "env_logger", "juniper", "log", @@ -5363,7 +5369,7 @@ dependencies = [ "actix-web-lab", "aws-config", "aws-sdk-s3", - "dotenvy", + "dotenvor", "env_logger", "futures-util", "log", @@ -5385,7 +5391,7 @@ version = "0.0.0" dependencies = [ "actix-web", "derive_more 2.0.1", - "dotenvy", + "dotenvor", "env_logger", "log", "mysql 24.0.0", @@ -7619,7 +7625,7 @@ dependencies = [ "chrono", "derive_more 2.0.1", "diesel", - "dotenvy", + "dotenvor", "env_logger", "log", "once_cell", @@ -8529,7 +8535,7 @@ dependencies = [ "actix-files", "actix-session", "actix-web", - "dotenvy", + "dotenvor", "env_logger", "log", "serde", @@ -9007,7 +9013,7 @@ name = "tracing-mainmatter-workshop" version = "0.0.0" dependencies = [ "actix-web", - "dotenvy", + "dotenvor", "metrics", "metrics-exporter-prometheus", "opentelemetry", diff --git a/Cargo.toml b/Cargo.toml index a1386cdb..b4604f76 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -104,7 +104,7 @@ async-stream = "0.3" chrono = { version = "0.4.30", features = ["serde"] } color-eyre = "0.6" derive_more = "2" -dotenvy = "0.15" +dotenvor = "0.1" env_logger = "0.11" examples-common = { path = "./examples-common" } eyre = { version = "0.6", default-features = false, features = ["auto-install", "track-caller"] } diff --git a/auth/simple-auth-server/Cargo.toml b/auth/simple-auth-server/Cargo.toml index 0ca14245..e899cf20 100644 --- a/auth/simple-auth-server/Cargo.toml +++ b/auth/simple-auth-server/Cargo.toml @@ -11,7 +11,7 @@ actix-web.workspace = true chrono.workspace = true derive_more = { workspace = true, features = ["display"] } diesel = { version = "2", features = ["postgres", "r2d2", "uuid", "chrono"] } -dotenvy.workspace = true +dotenvor.workspace = true env_logger.workspace = true log = "0.4" once_cell = "1" diff --git a/auth/simple-auth-server/README.md b/auth/simple-auth-server/README.md index be934641..39d62499 100644 --- a/auth/simple-auth-server/README.md +++ b/auth/simple-auth-server/README.md @@ -21,7 +21,7 @@ - [rust-argon2](https://crates.io/crates/rust-argon2) // crate for hashing passwords using the cryptographically-secure Argon2 hashing algorithm. - [chrono](https://crates.io/crates/chrono) // Date and time library for Rust. - [diesel](https://crates.io/crates/diesel) // A safe, extensible ORM and Query Builder for PostgreSQL, SQLite, and MySQL. -- [dotenvy](https://crates.io/crates/dotenvy) // A well-maintained dotenv implementation for Rust. +- [dotenvor](https://crates.io/crates/dotenvor) // A well-maintained dotenv implementation for Rust. - [derive_more](https://crates.io/crates/derive_more) // Convenience macros to derive traits easily - [env_logger](https://crates.io/crates/env_logger) // A logging implementation for log which is configured via an environment variable. - [futures](https://crates.io/crates/futures) // An implementation of futures and streams featuring zero allocations, composability, and iterator-like interfaces. diff --git a/auth/simple-auth-server/src/main.rs b/auth/simple-auth-server/src/main.rs index 85928668..1f9dbe4e 100644 --- a/auth/simple-auth-server/src/main.rs +++ b/auth/simple-auth-server/src/main.rs @@ -18,7 +18,7 @@ mod utils; #[actix_web::main] async fn main() -> std::io::Result<()> { - dotenvy::dotenv().ok(); + unsafe { dotenvor::dotenv() }.ok(); env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set"); diff --git a/background-jobs/Cargo.toml b/background-jobs/Cargo.toml index 87d851f9..31ff0c2c 100644 --- a/background-jobs/Cargo.toml +++ b/background-jobs/Cargo.toml @@ -10,7 +10,7 @@ apalis = { version = "0.6", features = ["limit"] } apalis-redis = { version = "0.6" } chrono.workspace = true color-eyre.workspace = true -dotenvy.workspace = true +dotenvor.workspace = true env_logger.workspace = true eyre.workspace = true log.workspace = true diff --git a/background-jobs/src/main.rs b/background-jobs/src/main.rs index b8a7380a..8a19ba1f 100644 --- a/background-jobs/src/main.rs +++ b/background-jobs/src/main.rs @@ -16,7 +16,7 @@ pub(crate) type ItemCache = Mutex>>; #[tokio::main] async fn main() -> eyre::Result<()> { color_eyre::install()?; - dotenvy::dotenv().ok(); + unsafe { dotenvor::dotenv() }.ok(); env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); // background jobs relating to local, disposable tasks diff --git a/basics/todo/Cargo.toml b/basics/todo/Cargo.toml index b7b3cd36..1e037745 100644 --- a/basics/todo/Cargo.toml +++ b/basics/todo/Cargo.toml @@ -8,7 +8,7 @@ actix-files.workspace = true actix-session = { workspace = true, features = ["cookie-session"] } actix-web.workspace = true -dotenvy.workspace = true +dotenvor.workspace = true env_logger.workspace = true log.workspace = true serde.workspace = true diff --git a/basics/todo/src/main.rs b/basics/todo/src/main.rs index 07c42d0c..01220555 100644 --- a/basics/todo/src/main.rs +++ b/basics/todo/src/main.rs @@ -7,7 +7,7 @@ use actix_web::{ middleware::{ErrorHandlers, Logger}, web, }; -use dotenvy::dotenv; +use dotenvor::dotenv; use tera::Tera; mod api; @@ -20,7 +20,7 @@ static SESSION_SIGNING_KEY: &[u8] = &[0; 64]; #[actix_web::main] async fn main() -> io::Result<()> { - dotenv().ok(); + unsafe { dotenv() }.ok(); env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); let key = actix_web::cookie::Key::from(SESSION_SIGNING_KEY); diff --git a/databases/diesel-async/Cargo.toml b/databases/diesel-async/Cargo.toml index 67dc5211..7a2f7fea 100644 --- a/databases/diesel-async/Cargo.toml +++ b/databases/diesel-async/Cargo.toml @@ -10,7 +10,7 @@ postgres_tests = [] actix-web = { workspace = true } diesel = { version = "2", default-features = false, features = ["uuid"] } diesel-async = { version = "0.5", features = ["postgres", "bb8", "async-connection-wrapper"] } -dotenvy = { workspace = true } +dotenvor = { workspace = true } env_logger = { workspace = true } log = { workspace = true } serde = { workspace = true } diff --git a/databases/diesel-async/src/main.rs b/databases/diesel-async/src/main.rs index fa9ae3c7..0c475f32 100644 --- a/databases/diesel-async/src/main.rs +++ b/databases/diesel-async/src/main.rs @@ -8,7 +8,7 @@ use diesel_async::{ AsyncPgConnection, pooled_connection::{AsyncDieselConnectionManager, bb8::Pool}, }; -use dotenvy::dotenv; +use dotenvor::dotenv; use uuid::Uuid; mod actions; @@ -74,7 +74,7 @@ async fn add_item( #[actix_web::main] async fn main() -> io::Result<()> { - dotenv().ok(); + unsafe { dotenv() }.ok(); env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); // initialize DB pool outside `HttpServer::new` so that it is shared across all workers @@ -116,7 +116,7 @@ mod tests { #[actix_web::test] async fn item_routes() { - dotenv().ok(); + unsafe { dotenv() }.ok(); env_logger::try_init_from_env(env_logger::Env::new().default_filter_or("info")).ok(); let pool = initialize_db_pool().await; diff --git a/databases/diesel/Cargo.toml b/databases/diesel/Cargo.toml index 739e0673..227ea9d9 100644 --- a/databases/diesel/Cargo.toml +++ b/databases/diesel/Cargo.toml @@ -6,7 +6,7 @@ rust-version.workspace = true [dependencies] actix-web.workspace = true diesel = { version = "2", features = ["sqlite", "r2d2", "uuid"] } -dotenvy.workspace = true +dotenvor.workspace = true env_logger.workspace = true log.workspace = true serde.workspace = true diff --git a/databases/diesel/src/main.rs b/databases/diesel/src/main.rs index 7f882e62..aa7d6cba 100644 --- a/databases/diesel/src/main.rs +++ b/databases/diesel/src/main.rs @@ -76,7 +76,7 @@ async fn add_user( #[actix_web::main] async fn main() -> std::io::Result<()> { - dotenvy::dotenv().ok(); + unsafe { dotenvor::dotenv() }.ok(); env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); // initialize DB pool outside of `HttpServer::new` so that it is shared across all workers @@ -118,7 +118,7 @@ mod tests { #[actix_web::test] async fn user_routes() { - dotenvy::dotenv().ok(); + unsafe { dotenvor::dotenv() }.ok(); env_logger::try_init_from_env(env_logger::Env::new().default_filter_or("info")).ok(); let pool = initialize_db_pool(); diff --git a/databases/mysql/Cargo.toml b/databases/mysql/Cargo.toml index 0df2e302..17efae90 100644 --- a/databases/mysql/Cargo.toml +++ b/databases/mysql/Cargo.toml @@ -6,7 +6,7 @@ rust-version.workspace = true [dependencies] actix-web.workspace = true derive_more = { workspace = true, features = ["display", "error", "from"] } -dotenvy.workspace = true +dotenvor.workspace = true env_logger.workspace = true log.workspace = true mysql = "24" diff --git a/databases/mysql/src/main.rs b/databases/mysql/src/main.rs index 0daaf23f..73e36500 100644 --- a/databases/mysql/src/main.rs +++ b/databases/mysql/src/main.rs @@ -24,7 +24,7 @@ fn get_conn_builder( #[actix_web::main] async fn main() -> io::Result<()> { // initialize environment - dotenvy::dotenv().ok(); + unsafe { dotenvor::dotenv() }.ok(); // initialize logger env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); diff --git a/databases/postgres/Cargo.toml b/databases/postgres/Cargo.toml index a25a1307..1d4c23f6 100644 --- a/databases/postgres/Cargo.toml +++ b/databases/postgres/Cargo.toml @@ -8,7 +8,7 @@ actix-web.workspace = true confik = "0.15" deadpool-postgres = { version = "0.14", features = ["serde"] } derive_more = { workspace = true, features = ["display", "error", "from"] } -dotenvy.workspace = true +dotenvor.workspace = true serde.workspace = true tokio-pg-mapper = "0.2.0" tokio-pg-mapper-derive = "0.2.0" diff --git a/databases/postgres/README.md b/databases/postgres/README.md index ff83aaa0..197fb1a9 100644 --- a/databases/postgres/README.md +++ b/databases/postgres/README.md @@ -5,7 +5,7 @@ - `tokio_postgres` - use of `tokio_pg_mapper` for postgres data mapping - `deadpool_postgres` for connection pooling -- `dotenvy` + `confik` for configuration +- `dotenvor` + `confik` for configuration ## Instructions diff --git a/databases/postgres/src/main.rs b/databases/postgres/src/main.rs index 4ab0f1c1..699cfb7b 100644 --- a/databases/postgres/src/main.rs +++ b/databases/postgres/src/main.rs @@ -4,7 +4,7 @@ use actix_web::{ }; use confik::{Configuration as _, EnvSource}; use deadpool_postgres::{Client, Pool}; -use dotenvy::dotenv; +use dotenvor::dotenv; use tokio_postgres::NoTls; use crate::config::ExampleConfig; @@ -39,7 +39,7 @@ pub async fn add_user( #[actix_web::main] async fn main() -> std::io::Result<()> { - dotenv().ok(); + unsafe { dotenv() }.ok(); let config = ExampleConfig::builder() .override_with(EnvSource::new()) diff --git a/forms/multipart-s3/Cargo.toml b/forms/multipart-s3/Cargo.toml index 0c1133e9..f15135ae 100644 --- a/forms/multipart-s3/Cargo.toml +++ b/forms/multipart-s3/Cargo.toml @@ -11,7 +11,7 @@ actix-web-lab.workspace = true aws-config = "1" aws-sdk-s3 = "1" -dotenvy.workspace = true +dotenvor.workspace = true env_logger.workspace = true futures-util.workspace = true log.workspace = true diff --git a/forms/multipart-s3/src/main.rs b/forms/multipart-s3/src/main.rs index a1ac3086..b72dad42 100644 --- a/forms/multipart-s3/src/main.rs +++ b/forms/multipart-s3/src/main.rs @@ -7,7 +7,7 @@ use actix_web::{ }; use actix_web_lab::extract::Path; use aws_config::{BehaviorVersion, meta::region::RegionProviderChain}; -use dotenvy::dotenv; +use dotenvor::dotenv; use futures_util::{StreamExt as _, stream}; use serde_json::json; use tokio_util::io::ReaderStream; @@ -93,7 +93,7 @@ async fn index() -> impl Responder { #[actix_web::main] async fn main() -> std::io::Result<()> { - dotenv().ok(); + unsafe { dotenv() }.ok(); env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); log::info!("creating temporary upload directory"); diff --git a/graphql/juniper-advanced/Cargo.toml b/graphql/juniper-advanced/Cargo.toml index 1bb5bb2c..277f1c6c 100644 --- a/graphql/juniper-advanced/Cargo.toml +++ b/graphql/juniper-advanced/Cargo.toml @@ -10,7 +10,7 @@ juniper = "0.16" mysql = "24" r2d2 = "0.8" r2d2_mysql = "24" -dotenvy.workspace = true +dotenvor.workspace = true env_logger.workspace = true log.workspace = true uuid.workspace = true diff --git a/graphql/juniper-advanced/src/main.rs b/graphql/juniper-advanced/src/main.rs index d704bfa5..d49e1504 100644 --- a/graphql/juniper-advanced/src/main.rs +++ b/graphql/juniper-advanced/src/main.rs @@ -9,7 +9,7 @@ use self::{db::get_db_pool, handlers::register}; #[actix_web::main] async fn main() -> std::io::Result<()> { - dotenvy::dotenv().ok(); + unsafe { dotenvor::dotenv() }.ok(); env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); let pool = get_db_pool(); diff --git a/tracing/mainmatter-workshop/Cargo.toml b/tracing/mainmatter-workshop/Cargo.toml index 4077cd4f..a9d9de76 100644 --- a/tracing/mainmatter-workshop/Cargo.toml +++ b/tracing/mainmatter-workshop/Cargo.toml @@ -5,7 +5,7 @@ rust-version.workspace = true [dependencies] actix-web.workspace = true -dotenvy.workspace = true +dotenvor.workspace = true metrics = "0.23" metrics-exporter-prometheus = { version = "0.15", default-features = false } opentelemetry = "0.23" diff --git a/tracing/mainmatter-workshop/src/main.rs b/tracing/mainmatter-workshop/src/main.rs index 9e04553e..88bf46dc 100644 --- a/tracing/mainmatter-workshop/src/main.rs +++ b/tracing/mainmatter-workshop/src/main.rs @@ -11,7 +11,7 @@ mod routes; #[actix_web::main] async fn main() -> io::Result<()> { - dotenvy::dotenv().ok(); + unsafe { dotenvor::dotenv() }.ok(); logging::init(); let handle = prometheus::init();