From 8c3f870321afc2956bcde28dd1a419b0c44603a2 Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Sat, 27 Jul 2019 17:13:11 +0200 Subject: [PATCH] Add command line parameters --- backend/src/config.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 backend/src/config.rs diff --git a/backend/src/config.rs b/backend/src/config.rs new file mode 100644 index 0000000..3e37ae2 --- /dev/null +++ b/backend/src/config.rs @@ -0,0 +1,20 @@ +use std::net::IpAddr; + +#[derive(StructOpt)] +pub(crate) struct Opt { + #[structopt(short = "p", long = "port", default_value = "8080")] + /// Port to listen on + pub(crate) port: u16, + #[structopt(short = "i", long = "interface", default_value = "0.0.0.0")] + /// Interface to listen on + pub(crate) interface: IpAddr, + #[structopt(short = "w", long = "workers", default_value = "4")] + /// Number of worker threads + pub(crate) workers: usize, + #[structopt(long = "gh-id")] + /// GitHub OAuth client ID + pub(crate) github_id: Option, + #[structopt(long = "gh-secret")] + /// GitHub OAuth client secret + pub(crate) github_secret: Option, +}