From 13a357fc9dbd4f51bbab7d27e80f2c9d06c0bdcf Mon Sep 17 00:00:00 2001 From: artech-git <45896902+artech-git@users.noreply.github.com> Date: Mon, 1 Aug 2022 04:08:34 +0530 Subject: [PATCH] dynamodb client updated for auth.rs obj.rs updated logging --- src/auth.rs | 8 ++++---- src/obj.rs | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/auth.rs b/src/auth.rs index bf71f48..72a773b 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -5,7 +5,7 @@ use http::header::HeaderMap; use http::header::{CONTENT_DISPOSITION, CONTENT_TYPE}; use totp_rs::{Algorithm, TOTP}; -use crate::db::DB_AWS; +use crate::db::DynamoDBClient; use crate::eval_constants::{get_step_size_value, get_totp_size_value}; use crate::obj::KEY_MAP; use crate::{ @@ -15,7 +15,7 @@ use crate::{ use qrcode_generator::QrCodeEcc; async fn get_user_key(email: &String) -> Option { - let client = DB_AWS.get().await; + let client = &DynamoDBClient.to_owned(); let key = "user_email".to_string(); let user_av = AttributeValue::S(email.to_owned()); @@ -97,7 +97,7 @@ async fn discover_user(email: &String) -> Option<()> { let email_av = AttributeValue::S(email.to_owned()); let key = "user_email".to_string(); - let client = DB_AWS.get().await; + let client = &DynamoDBClient.to_owned(); let table_name: String = KEY_MAP .get(&"auth-table".to_string()) @@ -134,7 +134,7 @@ async fn insert_user(email: &String, secret: &String) -> Option<()> { let email_av = AttributeValue::S(email.to_owned()); let secret_av = AttributeValue::S(secret.to_owned()); - let client = DB_AWS.get().await; + let client = &DynamoDBClient.to_owned(); let table_name: String = KEY_MAP .get(&"auth-table".to_string()) diff --git a/src/obj.rs b/src/obj.rs index 640be72..5796c6c 100644 --- a/src/obj.rs +++ b/src/obj.rs @@ -19,7 +19,10 @@ pub static KEY_MAP: Lazy> = Lazy::new(|| { .add_source(config::Environment::with_prefix("APP")) .build() { - Ok(v) => v, + Ok(v) => { + tracing::log::info!("settings.toml read"); + v + } Err(e) => { tracing::log::error!("cannot open the file: {}", e); panic!();