summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 2c7905f3bdb5c0cd2e35bc396c93ff4175b57108 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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::<u16>()
        .expect("port number");

    env_logger::init().unwrap();
    info!("Starting");
    linoquotes_gamma::server::serve(port);
}