refactor: Replace dotenv with dotenvy

This commit is contained in:
Emelie Graven 2022-09-12 11:08:56 +02:00
parent 75e12bac6c
commit 9afe483db4
No known key found for this signature in database
GPG key ID: 1098DC5C94CB1C87
5 changed files with 6 additions and 6 deletions

View file

@ -17,7 +17,7 @@ members = ["sqlxmq_macros", "sqlxmq_stress"]
[dependencies] [dependencies]
sqlx = { version = "0.6.0", features = ["postgres", "chrono", "uuid"] } sqlx = { version = "0.6.0", features = ["postgres", "chrono", "uuid"] }
tokio = { version = "1.8.3", features = ["full"] } tokio = { version = "1.8.3", features = ["full"] }
dotenv = "0.15.0" dotenvy = "0.15.3"
chrono = "0.4.19" chrono = "0.4.19"
uuid = { version = "1.1.2", features = ["v4"] } uuid = { version = "1.1.2", features = ["v4"] }
log = "0.4.14" log = "0.4.14"
@ -32,7 +32,7 @@ runtime-tokio-native-tls = ["sqlx/runtime-tokio-native-tls"]
runtime-tokio-rustls = ["sqlx/runtime-tokio-rustls"] runtime-tokio-rustls = ["sqlx/runtime-tokio-rustls"]
[dev-dependencies] [dev-dependencies]
dotenv = "0.15.0" dotenvy = "0.15.3"
pretty_env_logger = "0.4.0" pretty_env_logger = "0.4.0"
futures = "0.3.13" futures = "0.3.13"
tokio = { version = "1", features = ["full"] } tokio = { version = "1", features = ["full"] }

View file

@ -4,7 +4,7 @@ use tokio::time;
#[tokio::main] #[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> { async fn main() -> Result<(), Box<dyn std::error::Error>> {
dotenv::dotenv().ok(); dotenvy::dotenv().ok();
let db = sqlx::PgPool::connect(&std::env::var("DATABASE_URL").unwrap()).await?; let db = sqlx::PgPool::connect(&std::env::var("DATABASE_URL").unwrap()).await?;
sleep.builder().set_json(&5u64)?.spawn(&db).await?; sleep.builder().set_json(&5u64)?.spawn(&db).await?;

View file

@ -9,7 +9,7 @@ edition = "2018"
[dependencies] [dependencies]
sqlxmq = { path = ".." } sqlxmq = { path = ".." }
tokio = { version = "1.4.0", features = ["full"] } tokio = { version = "1.4.0", features = ["full"] }
dotenv = "0.15.0" dotenvy = "0.15.3"
sqlx = "0.6.0" sqlx = "0.6.0"
serde = "1.0.125" serde = "1.0.125"
lazy_static = "1.4.0" lazy_static = "1.4.0"

View file

@ -80,7 +80,7 @@ async fn schedule_tasks(num_jobs: usize, interval: Duration, pool: Pool<Postgres
#[tokio::main] #[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> { async fn main() -> Result<(), Box<dyn Error>> {
let _ = dotenv::dotenv(); let _ = dotenvy::dotenv();
let pool = Pool::connect(&env::var("DATABASE_URL")?).await?; let pool = Pool::connect(&env::var("DATABASE_URL")?).await?;

View file

@ -294,7 +294,7 @@ mod tests {
let guard = TEST_MUTEX.lock().await; let guard = TEST_MUTEX.lock().await;
let _ = dotenv::dotenv(); let _ = dotenvy::dotenv();
INIT_LOGGER.call_once(pretty_env_logger::init); INIT_LOGGER.call_once(pretty_env_logger::init);