summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 32333f1325dc666c9f8d606860fa96cb719df68c (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
30
31
32
33
34
35
36
#[macro_use]
extern crate clap;

fn main() {
    let matches = clap_app!(pjournal =>
                         (version: "0.1")
                         (author: "KJ Ørbekk <kj@orbekk.com>")
                         (about: "Practice Journaling")
                         (@arg strava_client_secret:
                          --strava_client_secret
                          +required +takes_value
                          "Client secret for strava authentication")
                         (@arg strava_client_id:
                          --strava_client_id
                          +required +takes_value
                          "Client id for strava authentication")
                         (@arg base_url:
                          --base_url
                          +takes_value
                          "Endpoint for this web app")
    )
    .get_matches();

    let config = pjournal::Config {
        client_id: matches
            .value_of("strava_client_id")
            .unwrap().to_string(),
        client_secret: matches
            .value_of("strava_client_secret")
            .unwrap().to_string(),
        base_url: matches
            .value_of("base_url")
            .unwrap_or("http://localhost:8000").to_string(),
    };
    pjournal::start_server(config);
}