- fix: warnings about unused variables

- add: LOG_LEVEL env variable
This commit is contained in:
2024-11-26 13:15:33 -05:00
parent e494860e9a
commit 815cb210dc
3 changed files with 15 additions and 17 deletions

View File

@@ -77,31 +77,31 @@ impl DatabaseClientTrait for DatabaseClient {
async fn store_password_reset(
&mut self,
email: &str,
reset_token: &str,
expires_at: DateTime<Utc>,
_email: &str,
_reset_token: &str,
_expires_at: DateTime<Utc>,
) -> Result<(), Box<dyn Error>> {
Ok(())
}
async fn get_password_reset(
&self,
reset_token: &str,
_reset_token: &str,
) -> Result<Option<PasswordReset>, Box<dyn std::error::Error>> {
todo!()
}
async fn delete_password_reset(
&self,
reset_token: &str,
_reset_token: &str,
) -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}
async fn update_user_password(
&self,
email: &str,
hashed_password: &str,
_email: &str,
_hashed_password: &str,
) -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}

View File

@@ -6,9 +6,10 @@ use auth_service::grpc::MyAuthService;
use dotenv::dotenv;
use std::env;
use std::net::ToSocketAddrs;
use std::str::FromStr;
use tokio::{select, signal};
use tonic::transport::Server;
use tracing::info;
use tracing::{info, Level};
use warp::Filter;
mod consul_registration;
@@ -20,9 +21,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
dotenv().ok();
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.with_thread_names(true)
.with_timer(tracing_subscriber::fmt::time::ChronoLocal::rfc_3339())
.with_max_level(Level::from_str(&env::var("LOG_LEVEL").unwrap_or_else(|_| "info".to_string())).unwrap_or_else(|_| Level::INFO))
.init();
// Set the gRPC server address

View File

@@ -7,10 +7,11 @@ use dotenv::dotenv;
use sqlx::postgres::PgPoolOptions;
use std::env;
use std::net::ToSocketAddrs;
use std::str::FromStr;
use std::sync::Arc;
use tokio::{select, signal};
use tonic::transport::Server;
use tracing::info;
use tracing::{info, Level};
use warp::Filter;
mod consul_registration;
@@ -19,9 +20,7 @@ mod consul_registration;
async fn main() -> Result<(), Box<dyn std::error::Error>> {
dotenv().ok();
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.with_thread_names(true)
.with_timer(tracing_subscriber::fmt::time::ChronoLocal::rfc_3339())
.with_max_level(Level::from_str(&env::var("LOG_LEVEL").unwrap_or_else(|_| "info".to_string())).unwrap_or_else(|_| Level::INFO))
.init();
let addr = env::var("DATABASE_SERVICE_ADDR").unwrap_or_else(|_| "127.0.0.1".to_string());
@@ -69,7 +68,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
};
// Pass `shared_cache` into services as needed
println!("Database Service running on {}", address);
info!("Database Service running on {}", address);
tokio::spawn(Server::builder()
.add_service(DatabaseServiceServer::new(database_service))
.serve(address));