Add support for not starting on same port.

This commit is contained in:
Dorian 2018-08-01 01:32:31 -04:00
parent d3891d5064
commit a4102cb912
2 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,7 @@ extern crate actix_web;
extern crate reqwest;
extern crate crypto;
extern crate env_logger;
#[macro_use] extern crate log;
extern crate rookeries;
@ -55,7 +56,8 @@ fn main() {
if args.arg_port > 0 {
let app = run_server(args.arg_port);
if app.is_err() {
eprintln!("Could not start server... exiting...");
error!("Could not start server on port {} because {}", args.arg_port, app.unwrap_err());
info!("Exiting...");
std::process::exit(1);
}
}

View File

@ -193,9 +193,9 @@ pub fn run_server(port: u32) -> Result<(), Box<Error>> {
.resource("/auth", |r| r.post().with(auth))
.resource("/api/pages/{slug}", |r| r.get().with(serve_page))
})
.bind(format!("0.0.0.0:{}", port))
.unwrap()
.bind(format!("0.0.0.0:{}", port))?
.run();
info!("Exiting...");
Ok(())
}