Merge remote-tracking branch 'origin/main'

fixed confilcting args -h (--host) and -h (--help)
This commit is contained in:
2024-03-23 22:31:40 +02:00
4 changed files with 41 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ pub struct CliArgs {
pub port: u16,
/// Host ip to bind to, usually not required to change
#[arg(short, long, default_value="0.0.0.0")]
#[arg(long, default_value="0.0.0.0")]
pub host: String,
/// Extra debugging output

View File

@@ -3,6 +3,7 @@ mod routes;
mod templates;
use actix_web::{web, App, HttpServer};
use actix_files as actix_fs;
use crate::cli::CliArgs;
@@ -12,7 +13,8 @@ pub(crate) async fn start_actix(cli: &CliArgs) -> anyhow::Result<()> {
log::info!("Serving an http server at http://{bindip}");
HttpServer::new(|| {
App::new()
.route("/", web::get().to(routes::index))
.route("/", web::get().to(routes::index)) // index.html
.service(actix_fs::Files::new("/static", "./static").index_file("index.html")) // static directoryh
})
.bind(bindip)?