summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs
index e96b736..aab9df3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,4 +1,5 @@
1use std::env; 1use std::env;
2use std::net::SocketAddr;
2use std::sync::Arc; 3use std::sync::Arc;
3use axum::{Router, routing::post}; 4use axum::{Router, routing::post};
4use axum::routing::{get, put}; 5use axum::routing::{get, put};
@@ -24,7 +25,10 @@ mod error;
24mod services; 25mod services;
25 26
26#[tokio::main] 27#[tokio::main]
27async fn main() { 28async fn main() -> color_eyre::eyre::Result<()> {
29
30 color_eyre::install()?;
31
28 unsafe { local_offset::set_soundness(local_offset::Soundness::Unsound); } 32 unsafe { local_offset::set_soundness(local_offset::Soundness::Unsound); }
29 let time_format = 33 let time_format =
30 time::macros::format_description!("[year]-[month]-[day] [hour]:[minute]:[second]"); 34 time::macros::format_description!("[year]-[month]-[day] [hour]:[minute]:[second]");
@@ -64,14 +68,15 @@ async fn main() {
64 68
65 let addr = SETTINGS.get_string("serveraddr").unwrap_or("0.0.0.0:7229".to_string()); 69 let addr = SETTINGS.get_string("serveraddr").unwrap_or("0.0.0.0:7229".to_string());
66 info!("start server on {}", addr); 70 info!("start server on {}", addr);
67 axum::Server::bind(&addr.parse().unwrap()) 71 let listener = tokio::net::TcpListener::bind(addr.parse::<SocketAddr>()?)
68 .serve(app.into_make_service()) 72 .await?;
69 .await 73 axum::serve(listener, app).await?;
70 .unwrap(); 74
75 Ok(())
71} 76}
72 77
73pub struct AppState { 78pub struct AppState {
74 db: PgPool, 79 db: PgPool,
75 ping_send: Sender<BroadcastCommands>, 80 ping_send: Sender<BroadcastCommands>,
76 ping_map: PingMap, 81 ping_map: PingMap,
77} \ No newline at end of file 82}