[proxy] Pass extra parameters to the console (#2467)

With this change we now pass additional params
to the console's auth methods.
This commit is contained in:
Dmitry Ivanov
2022-09-21 21:42:47 +03:00
committed by GitHub
parent 7eebb45ea6
commit e9a103c09f
13 changed files with 259 additions and 166 deletions

27
proxy/src/http/server.rs Normal file
View File

@@ -0,0 +1,27 @@
use anyhow::anyhow;
use hyper::{Body, Request, Response, StatusCode};
use std::net::TcpListener;
use utils::http::{endpoint, error::ApiError, json::json_response, RouterBuilder, RouterService};
async fn status_handler(_: Request<Body>) -> Result<Response<Body>, ApiError> {
json_response(StatusCode::OK, "")
}
fn make_router() -> RouterBuilder<hyper::Body, ApiError> {
let router = endpoint::make_router();
router.get("/v1/status", status_handler)
}
pub async fn thread_main(http_listener: TcpListener) -> anyhow::Result<()> {
scopeguard::defer! {
println!("http has shut down");
}
let service = || RouterService::new(make_router().build()?);
hyper::Server::from_tcp(http_listener)?
.serve(service().map_err(|e| anyhow!(e))?)
.await?;
Ok(())
}