about summary refs log tree commit diff stats
path: root/pkgs/by-name/ba/back/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/ba/back/src/main.rs')
-rw-r--r--pkgs/by-name/ba/back/src/main.rs33
1 files changed, 17 insertions, 16 deletions
diff --git a/pkgs/by-name/ba/back/src/main.rs b/pkgs/by-name/ba/back/src/main.rs
index 961c39b..61953c4 100644
--- a/pkgs/by-name/ba/back/src/main.rs
+++ b/pkgs/by-name/ba/back/src/main.rs
@@ -9,14 +9,11 @@
 // You should have received a copy of the License along with this program.
 // If not, see <https://www.gnu.org/licenses/agpl.txt>.
 
-use std::process;
+use std::{process, sync::Arc};
 
 use clap::Parser;
-use config::BackConfig;
-use rocket::routes;
-use web::feed;
 
-use crate::web::{closed, open, show_issue, styles};
+use crate::config::BackConfig;
 
 mod cli;
 pub mod config;
@@ -25,7 +22,7 @@ pub mod git_bug;
 mod web;
 
 fn main() -> Result<(), String> {
-    if let Err(err) = rocket_main() {
+    if let Err(err) = server_main() {
         eprintln!("Error {err}");
         process::exit(1);
     } else {
@@ -33,20 +30,24 @@ fn main() -> Result<(), String> {
     }
 }
 
-#[rocket::main]
-async fn rocket_main() -> Result<(), error::Error> {
+#[tokio::main]
+async fn server_main() -> Result<(), error::Error> {
     let args = cli::Cli::parse();
 
+    stderrlog::new()
+        .module(module_path!())
+        .modules(["hyper", "http"])
+        .quiet(false)
+        .show_module_names(false)
+        .color(stderrlog::ColorChoice::Auto)
+        .verbosity(2)
+        .timestamp(stderrlog::Timestamp::Off)
+        .init()
+        .expect("Let's just hope that this does not panic");
+
     let config = BackConfig::from_config_file(&args.config_file)?;
 
-    rocket::build()
-        .mount("/", routes![open, closed, show_issue, styles, feed])
-        .manage(config)
-        .ignite()
-        .await
-        .expect("This error should only happen on a miss-configuration.")
-        .launch()
-        .await?;
+    web::main(Arc::new(config)).await?;
 
     Ok(())
 }