Skip to content

Commit

Permalink
refactor: more db_client -> db
Browse files Browse the repository at this point in the history
  • Loading branch information
pjenvey committed Mar 30, 2023
1 parent 5a6a35a commit 61beb2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions autoconnect/autoconnect-settings/src/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{Settings, ENV_PREFIX};
#[derive(Clone)]
pub struct AppState {
/// Handle to the data storage object
pub db_client: Box<dyn DbClient>,
pub db: Box<dyn DbClient>,
pub metrics: Arc<StatsdClient>,

/// Encryption object for the endpoint URL
Expand Down Expand Up @@ -59,7 +59,7 @@ impl AppState {
dsn: settings.db_dsn.clone(),
db_settings: settings.db_settings.clone(),
};
let db_client = match StorageType::from_dsn(&db_settings.dsn) {
let db = match StorageType::from_dsn(&db_settings.dsn) {
StorageType::DynamoDb => Box::new(DdbClientImpl::new(metrics.clone(), &db_settings)?),
StorageType::INVALID => panic!("Invalid Storage type. Check {}_DB_DSN.", ENV_PREFIX),
};
Expand All @@ -68,7 +68,7 @@ impl AppState {
let endpoint_url = settings.endpoint_url();

Ok(Self {
db_client,
db,
metrics,
fernet,
registry: Arc::new(ClientRegistry::default()),
Expand Down
2 changes: 1 addition & 1 deletion autoconnect/autoconnect-web/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl Client {
pub async fn ws_handler(req: HttpRequest, body: Payload) -> Result<HttpResponse> {
let state = req.app_data::<AppState>().unwrap().clone();
let client_metrics = state.metrics.clone();
let db_client = state.db_client.clone();
let db_client = state.db.clone();
let clients = req.app_data::<ClientChannels>().unwrap().clone();
let ua_string = if let Some(header) = req.headers().get(actix_web::http::header::USER_AGENT)
{
Expand Down

0 comments on commit 61beb2e

Please sign in to comment.