rdserver
: Make use of the connect
feature
This commit is contained in:
parent
7b6af31ed5
commit
94450f5a88
3 changed files with 4 additions and 4 deletions
|
@ -10,7 +10,7 @@ keywords = ["jrd", "xrd", "hostmeta", "webfinger", "resource-descriptor"]
|
|||
categories = ["web-programming"]
|
||||
|
||||
[dependencies]
|
||||
acrate_database = { path = "../acrate_database" }
|
||||
acrate_database = { path = "../acrate_database", features = ["connect"] }
|
||||
acrate_rd = { path = "../acrate_rd" }
|
||||
anyhow = "1.0.93"
|
||||
axum = { version = "0.7.7", features = ["macros"] }
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
micronfig::config!(
|
||||
ACRATE_WEBFINGER_DATABASE_URL: String,
|
||||
ACRATE_WEBFINGER_BIND_ADDRESS: String,
|
||||
);
|
||||
|
|
|
@ -6,6 +6,7 @@ use axum::http::{HeaderMap, Response, StatusCode};
|
|||
use axum_extra::extract::Query;
|
||||
use mediatype::{MediaTypeBuf, MediaTypeList};
|
||||
use serde::Deserialize;
|
||||
use acrate_database::connect::connect_async;
|
||||
use acrate_database::diesel::GroupedBy;
|
||||
use acrate_database::diesel_async::{AsyncConnection, AsyncPgConnection};
|
||||
use acrate_database::meta::{MetaAlias, MetaLink, MetaLinkProperty, MetaLinkTitle, MetaProperty, MetaSubject};
|
||||
|
@ -17,7 +18,7 @@ pub async fn healthcheck_handler() -> Result<StatusCode, StatusCode> {
|
|||
log::debug!("Handling an healthcheck request!");
|
||||
|
||||
log::trace!("Making sure the database is up...");
|
||||
let _conn = AsyncPgConnection::establish(config::ACRATE_WEBFINGER_DATABASE_URL())
|
||||
let _conn = connect_async()
|
||||
.await
|
||||
.map_err(|_| StatusCode::BAD_GATEWAY)?;
|
||||
|
||||
|
@ -59,7 +60,7 @@ pub async fn webfinger_handler(
|
|||
|
||||
let mut response = Response::new("".to_string());
|
||||
|
||||
let mut conn = AsyncPgConnection::establish(config::ACRATE_WEBFINGER_DATABASE_URL())
|
||||
let mut conn = connect_async()
|
||||
.await
|
||||
.map_err(|_| StatusCode::BAD_GATEWAY)?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue