Create docker crate #6

Merged
steffo merged 8 commits from feature/docker into main 2024-12-12 03:39:42 +00:00
2 changed files with 12 additions and 0 deletions
Showing only changes of commit 0ac7a04477 - Show all commits

View file

@ -21,6 +21,7 @@ async fn main() -> anyhow::Result<std::convert::Infallible> {
log::trace!("Creating Axum router...");
let app = axum::Router::new()
.route("/*path", axum::routing::get(route::webfinger_handler))
.route("/.healthcheck", axum::routing::get(route::healthcheck_handler))
.layer(Extension(Arc::new(mj)));
log::trace!("Axum router created successfully!");

View file

@ -13,6 +13,17 @@ use acrate_rd::jrd::ResourceDescriptorLinkJRD;
use acrate_rd::xrd::{ResourceDescriptorLinkXRD, ResourceDescriptorPropertyXRD, ResourceDescriptorTitleXRD};
use crate::config;
pub async fn healthcheck_handler() -> Result<StatusCode, StatusCode> {
log::info!("Handling an healthcheck request!");
log::trace!("Making sure the database is up...");
let _conn = AsyncPgConnection::establish(config::ACRATE_WEBFINGER_DATABASE_URL())
.await
.map_err(|_| StatusCode::BAD_GATEWAY)?;
Ok(StatusCode::NO_CONTENT)
}
#[derive(Debug, Clone, Deserialize)]
pub struct WebfingerQuery {
pub resource: Option<String>,