Fix bind address of server
This commit is contained in:
@@ -3,8 +3,6 @@ use tera::Tera;
|
||||
|
||||
use crate::{handlers, templates, Args};
|
||||
|
||||
const ADDRESS: &str = "127.0.0.1";
|
||||
|
||||
pub async fn run(args: &Args) -> Result<(), ServerError> {
|
||||
std::fs::create_dir_all(&args.schem_dir_path)?;
|
||||
|
||||
@@ -12,6 +10,8 @@ pub async fn run(args: &Args) -> Result<(), ServerError> {
|
||||
let mut tera = Tera::default();
|
||||
tera.add_raw_template("index.html", templates::INDEX_HTML)?;
|
||||
|
||||
println!("server running and listening on {}:{}", args.address, args.port);
|
||||
|
||||
HttpServer::new(move || {
|
||||
App::new()
|
||||
.app_data(Data::new(cloned_args.clone()))
|
||||
@@ -22,7 +22,7 @@ pub async fn run(args: &Args) -> Result<(), ServerError> {
|
||||
.route("/download/{filename:.*}", web::get().to(handlers::download))
|
||||
.route("/upload", web::post().to(handlers::upload))
|
||||
})
|
||||
.bind((ADDRESS, args.port))?
|
||||
.bind((args.address.clone(), args.port))?
|
||||
.run()
|
||||
.await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user