summaryrefslogtreecommitdiff
path: root/src/bin/main.rs
blob: 94bdd71616fe657039090901fd6d2f34612f2814 (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
// CSRF protection
// https://github.com/heartsucker/iron-csrf
#[macro_use]
extern crate log;
extern crate systemhttp;
extern crate env_logger;
#[macro_use]
extern crate clap;

fn main() {
    let matches = clap_app!(
        systemhttpd =>
            (version: "0.1")
            (author: "Kjetil Ørbekk")
            (about: "A systemd web frontend")
            (@arg PORT: -p --port +takes_value "Port to serve on"))
        .get_matches();

    let port = matches.value_of("PORT").unwrap_or("8080")
        .parse::<u16>().expect("port number");

    env_logger::init().unwrap();
    let _server = systemhttp::server::serve(port).unwrap();
    println!("Serving on {}", port);
}