diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2024-09-19 22:09:20 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2024-09-19 22:09:20 +0200 |
commit | eec01c9b72feff9533477014881b982124ca7b6d (patch) | |
tree | 084586316e04f01f48b479de0cb41113639ac8d5 /src/main.rs | |
download | odr-dabmux-gui-eec01c9b72feff9533477014881b982124ca7b6d.tar.gz odr-dabmux-gui-eec01c9b72feff9533477014881b982124ca7b6d.tar.bz2 odr-dabmux-gui-eec01c9b72feff9533477014881b982124ca7b6d.zip |
Create project
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e64570a --- /dev/null +++ b/src/main.rs @@ -0,0 +1,31 @@ +use std::sync::{Arc, Mutex}; +use anyhow::{anyhow, Context}; +use log::{debug, info, warn, error}; + +mod ui; +mod config; + +struct AppState { + conf : config::Config, +} + +type SharedState = Arc<Mutex<AppState>>; + +#[tokio::main] +async fn main() -> std::io::Result<()> { + simple_logger::SimpleLogger::new() + .with_level(log::LevelFilter::Debug) + .env() + .init().unwrap(); + + let conf = config::Config::load().expect("Could not load config"); + + let shared_state = Arc::new(Mutex::new(AppState { + conf : conf.clone(), + })); + + let port = 3000; + info!("Setting up listener on port {port}"); + ui::serve(port, shared_state).await; + Ok(()) +} |