Skip to content

Commit

Permalink
dynamodb client updated for auth.rs
Browse files Browse the repository at this point in the history
obj.rs updated logging
  • Loading branch information
artech-git committed Jul 31, 2022
1 parent 6f132ff commit 13a357f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -15,7 +15,7 @@ use crate::{
use qrcode_generator::QrCodeEcc;

async fn get_user_key(email: &String) -> Option<String> {
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());
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
5 changes: 4 additions & 1 deletion src/obj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ pub static KEY_MAP: Lazy<HashMap<String, String>> = 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!();
Expand Down

0 comments on commit 13a357f

Please sign in to comment.