From 845073c29d3eaf774cceb8b1df7dbf2443810540 Mon Sep 17 00:00:00 2001 From: Thomas Wickham Date: Tue, 2 Mar 2021 20:13:58 +0100 Subject: [PATCH] Add Clap and base config --- Cargo.toml | 20 +++++++++++++++++++- src/domain/.keep | 0 src/infra/cli.rs | 10 ++++++++++ src/infra/configuration.rs | 6 ++++++ src/infra/mod.rs | 2 ++ src/main.rs | 6 +++++- 6 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 src/domain/.keep create mode 100644 src/infra/cli.rs create mode 100644 src/infra/configuration.rs create mode 100644 src/infra/mod.rs diff --git a/Cargo.toml b/Cargo.toml index d994aa7..62dccd1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,29 @@ [package] name = "lldap" +edition = "2018" version = "0.1.0" authors = [ "Valentin Tolmer ", "Steve Barrau ", "Thomas Wickham " ] -edition = "2018" [dependencies] +clap = "3.0.0-beta.2" +actix-web = "3" +anyhow = "*" +thiserror="*" +http = "*" +passablewords = "*" +serde = "*" +tracing = "*" +tracing-actix-web = "*" +tracing-log = "*" +tracing-subscriber = "*" + +[dependencies.figment] +features = ["toml", "env"] +version = "*" + +[dev-dependencies] +actix-rt = "*" diff --git a/src/domain/.keep b/src/domain/.keep new file mode 100644 index 0000000..e69de29 diff --git a/src/infra/cli.rs b/src/infra/cli.rs new file mode 100644 index 0000000..049ee67 --- /dev/null +++ b/src/infra/cli.rs @@ -0,0 +1,10 @@ +use clap::Clap; + +/// lldap is a lightweight LDAP server +#[derive(Debug, Clap)] +#[clap(version = "0.1", author = "The LLDAP team")] +pub struct CLIOpts; + +pub fn init() -> CLIOpts { + CLIOpts::parse() +} diff --git a/src/infra/configuration.rs b/src/infra/configuration.rs new file mode 100644 index 0000000..4880f38 --- /dev/null +++ b/src/infra/configuration.rs @@ -0,0 +1,6 @@ +#[derive(Debug, Default)] +pub struct Configuration; + +pub fn init() -> Configuration { + Configuration::default() +} diff --git a/src/infra/mod.rs b/src/infra/mod.rs new file mode 100644 index 0000000..d01d024 --- /dev/null +++ b/src/infra/mod.rs @@ -0,0 +1,2 @@ +pub mod cli; +pub mod configuration; diff --git a/src/main.rs b/src/main.rs index e7a11a9..d41b24a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,7 @@ +mod infra; + fn main() { - println!("Hello, world!"); + let config = infra::configuration::init(); + let cli_opts = infra::cli::init(); + println!("Hello, world! Config: {:?}, CLI: {:?}", config, cli_opts); }