Initial commit.

Signed-off-by: Edu4rdSHL <edu4rdshl@protonmail.com>
This commit is contained in:
Edu4rdSHL 2021-06-09 19:48:31 -05:00
parent 23f888270e
commit f711691e11
No known key found for this signature in database
GPG key ID: 3A574A4009F553E5
2 changed files with 26 additions and 19 deletions

View file

@ -1,2 +1,2 @@
file1.txt:8080
file2.txt:9090
file2.txt:8090

View file

@ -1,4 +1,4 @@
use std::{collections::HashMap, u16};
use std::{collections::HashMap, path::Path, u16};
use webtail_rs::{
structs::{File, State},
@ -36,6 +36,7 @@ fn main() {
input_files
.par_iter()
.map(|(file, port)| {
if Path::new(&file).exists() {
println!("=> Watching file {} in port {}\n", file, port);
let error = rocket::custom(
Config::build(Environment::Production)
@ -52,7 +53,13 @@ fn main() {
.mount("/", routes![updates])
.mount("/", StaticFiles::from("static"))
.launch();
eprintln!("Launch failed! Error: {}", error);
eprintln!(
"Launch failed for file {} in port {}! Error: {}",
file, port, error
);
} else {
eprintln!("Ignoring file {} because doesn't exists.", file)
}
})
.collect::<Vec<()>>();
}