mirror of
https://github.com/edu4rdshl/webtail-rs.git
synced 2026-07-17 23:24:50 +00:00
Initial commit.
Signed-off-by: Edu4rdSHL <edu4rdshl@protonmail.com>
This commit is contained in:
parent
23f888270e
commit
f711691e11
2 changed files with 26 additions and 19 deletions
|
|
@ -1,2 +1,2 @@
|
|||
file1.txt:8080
|
||||
file2.txt:9090
|
||||
file2.txt:8090
|
||||
|
|
|
|||
11
src/main.rs
11
src/main.rs
|
|
@ -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<()>>();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue