diff --git a/auth-service/src/database_client.rs b/auth-service/src/database_client.rs index 5538c71..7fca936 100644 --- a/auth-service/src/database_client.rs +++ b/auth-service/src/database_client.rs @@ -77,31 +77,31 @@ impl DatabaseClientTrait for DatabaseClient { async fn store_password_reset( &mut self, - email: &str, - reset_token: &str, - expires_at: DateTime, + _email: &str, + _reset_token: &str, + _expires_at: DateTime, ) -> Result<(), Box> { Ok(()) } async fn get_password_reset( &self, - reset_token: &str, + _reset_token: &str, ) -> Result, Box> { todo!() } async fn delete_password_reset( &self, - reset_token: &str, + _reset_token: &str, ) -> Result<(), Box> { Ok(()) } async fn update_user_password( &self, - email: &str, - hashed_password: &str, + _email: &str, + _hashed_password: &str, ) -> Result<(), Box> { Ok(()) } diff --git a/auth-service/src/main.rs b/auth-service/src/main.rs index e0aaa2d..39767ad 100644 --- a/auth-service/src/main.rs +++ b/auth-service/src/main.rs @@ -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> { 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 diff --git a/database-service/src/main.rs b/database-service/src/main.rs index 3c34bfc..ead41dc 100644 --- a/database-service/src/main.rs +++ b/database-service/src/main.rs @@ -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> { 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> { }; // 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)); @@ -77,7 +76,7 @@ async fn main() -> Result<(), Box> { select! { _ = signal::ctrl_c() => {}, } - + consul_registration::deregister_service(&consul_url, service_name.as_str()).await.expect(""); info!("service {} deregistered", service_name); Ok(())