mirror of
https://github.com/actix/examples
synced 2024-11-27 16:02:57 +01:00
update dotenv::dotenv references
This commit is contained in:
parent
07bb27eb4b
commit
e2c32161a9
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -7,6 +7,7 @@
|
|||||||
"autoreload",
|
"autoreload",
|
||||||
"chrono",
|
"chrono",
|
||||||
"dotenv",
|
"dotenv",
|
||||||
|
"dotenvy",
|
||||||
"graphiql",
|
"graphiql",
|
||||||
"minijinja",
|
"minijinja",
|
||||||
"nocapture",
|
"nocapture",
|
||||||
|
@ -18,7 +18,7 @@ mod utils;
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
dotenv::dotenv().ok();
|
dotenvy::dotenv().ok();
|
||||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
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");
|
let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
||||||
|
@ -15,7 +15,7 @@ pub(crate) type ItemCache = Mutex<HashMap<String, DateTime<Utc>>>;
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> anyhow::Result<()> {
|
async fn main() -> anyhow::Result<()> {
|
||||||
dotenv::dotenv().ok();
|
dotenvy::dotenv().ok();
|
||||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
|
|
||||||
// background jobs relating to local, disposable tasks
|
// background jobs relating to local, disposable tasks
|
||||||
|
@ -7,7 +7,7 @@ use actix_web::{
|
|||||||
middleware::{ErrorHandlers, Logger},
|
middleware::{ErrorHandlers, Logger},
|
||||||
web, App, HttpServer,
|
web, App, HttpServer,
|
||||||
};
|
};
|
||||||
use dotenv::dotenv;
|
use dotenvy::dotenv;
|
||||||
use tera::Tera;
|
use tera::Tera;
|
||||||
|
|
||||||
mod api;
|
mod api;
|
||||||
|
@ -76,7 +76,7 @@ async fn add_user(
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
dotenv::dotenv().ok();
|
dotenvy::dotenv().ok();
|
||||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
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
|
// initialize DB pool outside of `HttpServer::new` so that it is shared across all workers
|
||||||
@ -118,7 +118,7 @@ mod tests {
|
|||||||
|
|
||||||
#[actix_web::test]
|
#[actix_web::test]
|
||||||
async fn user_routes() {
|
async fn user_routes() {
|
||||||
dotenv::dotenv().ok();
|
dotenvy::dotenv().ok();
|
||||||
env_logger::try_init_from_env(env_logger::Env::new().default_filter_or("info")).ok();
|
env_logger::try_init_from_env(env_logger::Env::new().default_filter_or("info")).ok();
|
||||||
|
|
||||||
let pool = initialize_db_pool();
|
let pool = initialize_db_pool();
|
||||||
|
@ -24,7 +24,7 @@ fn get_conn_builder(
|
|||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> io::Result<()> {
|
async fn main() -> io::Result<()> {
|
||||||
// initialize environment
|
// initialize environment
|
||||||
dotenv::dotenv().ok();
|
dotenvy::dotenv().ok();
|
||||||
|
|
||||||
// initialize logger
|
// initialize logger
|
||||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
|
@ -125,7 +125,7 @@ mod handlers {
|
|||||||
|
|
||||||
use ::config::Config;
|
use ::config::Config;
|
||||||
use actix_web::{web, App, HttpServer};
|
use actix_web::{web, App, HttpServer};
|
||||||
use dotenv::dotenv;
|
use dotenvy::dotenv;
|
||||||
use handlers::{add_user, get_users};
|
use handlers::{add_user, get_users};
|
||||||
use tokio_postgres::NoTls;
|
use tokio_postgres::NoTls;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ use actix_web::{
|
|||||||
};
|
};
|
||||||
use actix_web_lab::{extract::Path, respond::Html};
|
use actix_web_lab::{extract::Path, respond::Html};
|
||||||
use aws_config::meta::region::RegionProviderChain;
|
use aws_config::meta::region::RegionProviderChain;
|
||||||
use dotenv::dotenv;
|
use dotenvy::dotenv;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
mod client;
|
mod client;
|
||||||
|
@ -9,7 +9,7 @@ use self::{db::get_db_pool, handlers::register};
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
dotenv::dotenv().ok();
|
dotenvy::dotenv().ok();
|
||||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
|
|
||||||
let pool = get_db_pool();
|
let pool = get_db_pool();
|
||||||
|
Loading…
Reference in New Issue
Block a user