main: Use labadoor-auth instead of the CSV module directly

This commit is contained in:
George Kaklamanos 2023-11-22 19:44:10 +02:00
parent 2caad2a5ef
commit e7c34865c5
Signed by: gkaklas
GPG key ID: C0CAB8A6BDC9399D
6 changed files with 41 additions and 30 deletions

View file

@ -13,8 +13,6 @@ pub enum Command {
Telegram(Telegram),
#[cfg(feature = "matrix")]
Matrix(Matrix),
#[cfg(feature = "csv")]
CSV(CSV),
#[cfg(feature = "gpio")]
GPIO(GPIO),
#[cfg(feature = "auth")]
@ -39,21 +37,6 @@ pub struct Matrix {
pub device_id: Option<String>,
}
#[cfg(feature = "csv")]
#[derive(Deserialize, Parser, Debug)]
pub struct CSV {
#[clap(short, long)]
#[arg(default_value = "Some(String::from(\"/etc/labadoor\"))")]
pub path: Option<String>,
#[clap(short, long)]
pub method: String,
#[clap(short, long)]
pub identifier: String,
// #[cfg(feature = "multiple_resources")]
#[clap(short, long)]
pub resource_shortcut: i8,
}
#[cfg(feature = "gpio")]
#[derive(Deserialize, Parser, Debug)]
pub struct GPIO {

View file

@ -1,4 +1,3 @@
use labadoor_acl::ACL;
mod cli;
mod to_config;
use to_config::ToConfig;
@ -21,14 +20,6 @@ fn main() {
let matrix = config.get::<cli::Matrix>("matrix").unwrap().to_config();
labadoor_matrix::matrix(matrix);
}
#[cfg(feature = "csv")]
cli::Command::CSV(_) => {
let csv = config.get::<cli::CSV>("csv").unwrap();
let c = labadoor_csv::CSV {
path: csv.path.unwrap(),
};
c.auth_user(csv.method, csv.identifier, csv.resource_shortcut);
}
#[cfg(feature = "gpio")]
cli::Command::GPIO(_) => {
let gpio = config.get::<cli::GPIO>("gpio").unwrap().to_config();
@ -36,7 +27,7 @@ fn main() {
}
#[cfg(feature = "auth")]
cli::Command::Auth(cli) => {
labadoor_auth::auth(cli);
labadoor_auth::auth(cli, config);
}
}
}