Add Clap and base config

This commit is contained in:
Thomas Wickham 2021-03-02 20:13:58 +01:00
parent 6519b5c894
commit 845073c29d
6 changed files with 42 additions and 2 deletions

View File

@ -1,11 +1,29 @@
[package]
name = "lldap"
edition = "2018"
version = "0.1.0"
authors = [
"Valentin Tolmer <valentin@tolmer.fr>",
"Steve Barrau <steve.barrau@gmail.com>",
"Thomas Wickham <mackwic@gmail.com>"
]
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 = "*"

0
src/domain/.keep Normal file
View File

10
src/infra/cli.rs Normal file
View File

@ -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()
}

View File

@ -0,0 +1,6 @@
#[derive(Debug, Default)]
pub struct Configuration;
pub fn init() -> Configuration {
Configuration::default()
}

2
src/infra/mod.rs Normal file
View File

@ -0,0 +1,2 @@
pub mod cli;
pub mod configuration;

View File

@ -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);
}