From 1e4dff1995833538f436b381bc0450a7c0080bad Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Mon, 12 May 2025 12:39:10 +0200 Subject: chore: Initial commit Based on the version that was previously in `vhack.eu/nixos-server/pkgs/by-name/ba/back`. --- src/main.rs | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/main.rs (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..49ffe5c --- /dev/null +++ b/src/main.rs @@ -0,0 +1,54 @@ +// Back - An extremely simple git bug visualization system. Inspired by TVL's +// panettone. +// +// Copyright (C) 2024 Benedikt Peetz +// Copyright (C) 2025 Benedikt Peetz +// SPDX-License-Identifier: AGPL-3.0-or-later +// +// This file is part of Back. +// +// You should have received a copy of the License along with this program. +// If not, see . + +use std::{process, sync::Arc}; + +use clap::Parser; + +use crate::config::BackConfig; + +mod cli; +pub mod config; +mod error; +pub mod git_bug; +mod web; + +fn main() -> Result<(), String> { + if let Err(err) = server_main() { + eprintln!("Error {err}"); + process::exit(1); + } else { + Ok(()) + } +} + +#[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)?; + + web::main(Arc::new(config)).await?; + + Ok(()) +} -- cgit 1.4.1