From 24fd328a34b6c9ffef29a8d4566c7d1065ee5682 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Sat, 8 Jul 2017 23:51:11 -0400 Subject: Application boilerplate. Serves an empty page. --- src/main.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main.rs (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..2c7905f --- /dev/null +++ b/src/main.rs @@ -0,0 +1,29 @@ +#[macro_use] +extern crate log; +extern crate env_logger; +extern crate clap; +extern crate linoquotes_gamma; + +use clap::{App, Arg}; + +fn main() { + let matches = App::new("linoquotes") + .version("3.0.0") + .author("Kjetil Ørbekk") + .about("Quote db for #linux.no. Run with \ + RUST_LOG=linoquotes_gamma=info to enable logging.") + .arg(Arg::with_name("port") + .short("p").long("port").takes_value(true) + .help("Port to serve on")) + .get_matches(); + + let port = matches + .value_of("port") + .unwrap_or("8080") + .parse::() + .expect("port number"); + + env_logger::init().unwrap(); + info!("Starting"); + linoquotes_gamma::server::serve(port); +} -- cgit v1.2.3