chore: replace dotenv with dotenvy (#2003)

* chore: replace `dotenv` with `dotenvy`

The former appears to be unmaintained and the latter is a drop-in replacement.

* chore: fix all warnings
This commit is contained in:
Austin Bonander
2022-07-28 14:33:44 -07:00
committed by GitHub
parent 05d64fb722
commit a2eceec33b
32 changed files with 70 additions and 62 deletions

View File

@@ -9,4 +9,4 @@ edition = "2021"
anyhow = "1.0"
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-tokio-native-tls"] }
tokio = { version = "1.20.0", features = ["macros"]}
dotenv = "0.15.0"
dotenvy = "0.15.0"

View File

@@ -28,7 +28,7 @@ impl Display for PostWithAuthorQuery {
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let pool = PgPool::connect(&dotenv::var("DATABASE_URL")?).await?;
let pool = PgPool::connect(&dotenvy::var("DATABASE_URL")?).await?;
// we can use a tranditional wrapper around the `query!()` macro using files
query_file!("queries/insert_seed_data.sql")

View File

@@ -6,7 +6,7 @@ workspace = "../../../"
[dependencies]
anyhow = "1.0"
dotenv = "0.15.0"
dotenvy = "0.15.0"
futures = "0.3"
serde = { version = "1", features = ["derive"] }
serde_json = "1"

View File

@@ -33,7 +33,7 @@ struct Row {
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let args = Args::from_args_safe()?;
let pool = PgPool::connect(&dotenv::var("DATABASE_URL")?).await?;
let pool = PgPool::connect(&dotenvy::var("DATABASE_URL")?).await?;
match args.cmd {
Some(Command::Add) => {

View File

@@ -10,6 +10,6 @@ futures = "0.3"
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-tokio-native-tls"] }
structopt = "0.3"
tokio = { version = "1.20.0", features = ["macros"]}
dotenv = "0.15.0"
dotenvy = "0.15.0"
async-trait = "0.1.41"
mockall = "0.11"

View File

@@ -1,5 +1,4 @@
use async_trait::async_trait;
use dotenv;
use sqlx::postgres::PgPool;
use std::{env, io::Write, sync::Arc};
use structopt::StructOpt;
@@ -18,7 +17,7 @@ enum Command {
#[tokio::main]
async fn main() -> anyhow::Result<()> {
dotenv::dotenv().ok();
dotenvy::dotenv().ok();
let args = Args::from_args_safe()?;
let pool = PgPool::connect(&env::var("DATABASE_URL")?).await?;
let todo_repo = PostgresTodoRepo::new(pool);

View File

@@ -10,4 +10,4 @@ futures = "0.3"
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-tokio-native-tls"] }
structopt = "0.3"
tokio = { version = "1.20.0", features = ["macros"]}
dotenv = "0.15.0"
dotenvy = "0.15.0"