mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 02:57:02 +08:00
feat(api): use ApiClient trait in AppState (#2067)
This commit is contained in:
@ -169,7 +169,16 @@ pub async fn start_server(conf: settings::Settings) -> ApplicationResult<Server>
|
||||
logger::debug!(startup_config=?conf);
|
||||
let server = conf.server.clone();
|
||||
let (tx, rx) = oneshot::channel();
|
||||
let state = routes::AppState::new(conf, tx).await;
|
||||
let api_client = Box::new(
|
||||
services::ProxyClient::new(
|
||||
conf.proxy.clone(),
|
||||
services::proxy_bypass_urls(&conf.locker),
|
||||
)
|
||||
.map_err(|error| {
|
||||
errors::ApplicationError::ApiClientError(error.current_context().clone())
|
||||
})?,
|
||||
);
|
||||
let state = routes::AppState::new(conf, tx, api_client).await;
|
||||
let request_body_limit = server.request_body_limit;
|
||||
let server = actix_web::HttpServer::new(move || mk_app(state.clone(), request_body_limit))
|
||||
.bind((server.host.as_str(), server.port))?
|
||||
|
||||
Reference in New Issue
Block a user