mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
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:
@@ -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"
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user