- add: missing call to dotenv

- remove: unreachable code in route_packet
This commit is contained in:
2024-11-26 13:17:27 -05:00
parent 47899d47cd
commit 889fde4636
2 changed files with 2 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
use std::env; use std::env;
use std::str::FromStr; use std::str::FromStr;
use dotenv::dotenv;
use tokio::net::TcpListener; use tokio::net::TcpListener;
use tokio::io::{AsyncReadExt}; use tokio::io::{AsyncReadExt};
use tracing::{info, error}; use tracing::{info, error};
@@ -10,6 +11,7 @@ mod router;
#[tokio::main] #[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> { async fn main() -> Result<(), Box<dyn std::error::Error>> {
dotenv().ok();
tracing_subscriber::fmt() tracing_subscriber::fmt()
.with_max_level(Level::from_str(&env::var("LOG_LEVEL").unwrap_or_else(|_| "info".to_string())).unwrap_or_else(|_| Level::INFO)) .with_max_level(Level::from_str(&env::var("LOG_LEVEL").unwrap_or_else(|_| "info".to_string())).unwrap_or_else(|_| Level::INFO))
.init(); .init();

View File

@@ -10,6 +10,4 @@ pub async fn route_packet(data: &[u8]) -> Result<(), Box<dyn Error>> {
// 2 => movement::handle_movement(packet).await?, // 2 => movement::handle_movement(packet).await?,
_ => return Err("Unknown packet type".into()), _ => return Err("Unknown packet type".into()),
} }
Ok(())
} }