summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authormrw1593 <botahamec@outlook.com>2023-05-14 11:59:40 -0400
committermrw1593 <botahamec@outlook.com>2023-05-29 10:46:03 -0400
commit3f0cfb69f2ab1dda4425fe871a6cbf3b4bfb8dc3 (patch)
treee720ee975ac907a563022219f72e21d78203bd99 /src/main.rs
parentdbc9bac5f5a9dce489afffaf3ffa081208f974d4 (diff)
Load `.env` file
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 15d28e9..7d2b643 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -23,6 +23,10 @@ fn error_content_language<B>(
#[actix_web::main]
async fn main() -> Result<(), RawUnexpected> {
+ // load the environment file, but only in debug mode
+ #[cfg(debug_assertions)]
+ dotenv::dotenv()?;
+
// initialize the database
let db_url = secrets::database_url()?;
let sql_pool = db::initialize(&db_url).await?;
@@ -31,7 +35,7 @@ async fn main() -> Result<(), RawUnexpected> {
HttpServer::new(move || {
App::new()
.wrap(ErrorHandlers::new().default_handler(error_content_language))
- .wrap(Logger::new("[%t] \"%r\" %s %Dms"))
+ .wrap(Logger::new("\"%r\" %s %Dms"))
.app_data(Data::new(sql_pool.clone()))
.service(api::liveops())
.service(api::users())