aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorFxQnLr <[email protected]>2023-11-29 15:48:26 +0100
committerFxQnLr <[email protected]>2023-11-29 15:48:26 +0100
commit6f94a825485b1d622d8ebe88ddf3e2f426d1c69c (patch)
treebabf4a5c1dcb7746185a1c97e0d889df07df20e8 /src/main.rs
parentda6367885d31698464e1bec122e3e673974427c6 (diff)
downloadwebol-6f94a825485b1d622d8ebe88ddf3e2f426d1c69c.tar
webol-6f94a825485b1d622d8ebe88ddf3e2f426d1c69c.tar.gz
webol-6f94a825485b1d622d8ebe88ddf3e2f426d1c69c.zip
update to axum 0.7 and cargo update
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}