Implemented user specifieable host and port
This commit is contained in:
parent
46e3eea247
commit
bd7dce7981
|
@ -10,7 +10,7 @@ async fn main() -> std::io::Result<()> {
|
||||||
logger::init_logger(&cli);
|
logger::init_logger(&cli);
|
||||||
|
|
||||||
|
|
||||||
if let Err(e) = public::start_actix().await {
|
if let Err(e) = public::start_actix(&cli).await {
|
||||||
log::error!("Actix had an error: {e}");
|
log::error!("Actix had an error: {e}");
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -4,14 +4,18 @@ mod templates;
|
||||||
|
|
||||||
use actix_web::{web, App, HttpServer};
|
use actix_web::{web, App, HttpServer};
|
||||||
|
|
||||||
pub(crate) async fn start_actix() -> anyhow::Result<()> {
|
use crate::cli::CliArgs;
|
||||||
log::info!("Serving an http server at http://0.0.0.0:8080");
|
|
||||||
|
pub(crate) async fn start_actix(cli: &CliArgs) -> anyhow::Result<()> {
|
||||||
|
let bindip = format!("{}:{}", cli.host, cli.port);
|
||||||
|
|
||||||
|
log::info!("Serving an http server at http://{bindip}");
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
App::new()
|
App::new()
|
||||||
.route("/", web::get().to(routes::index))
|
.route("/", web::get().to(routes::index))
|
||||||
})
|
})
|
||||||
|
|
||||||
.bind("0.0.0.0:8080")?
|
.bind(bindip)?
|
||||||
.run()
|
.run()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user