diff --git a/acrate_rdserver/Cargo.toml b/acrate_rdserver/Cargo.toml index 43b0148..bdff788 100644 --- a/acrate_rdserver/Cargo.toml +++ b/acrate_rdserver/Cargo.toml @@ -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"] } diff --git a/acrate_rdserver/src/config.rs b/acrate_rdserver/src/config.rs index feb7905..535a5c4 100644 --- a/acrate_rdserver/src/config.rs +++ b/acrate_rdserver/src/config.rs @@ -1,4 +1,3 @@ micronfig::config!( - ACRATE_WEBFINGER_DATABASE_URL: String, ACRATE_WEBFINGER_BIND_ADDRESS: String, ); diff --git a/acrate_rdserver/src/route.rs b/acrate_rdserver/src/route.rs index 9821182..5405f20 100644 --- a/acrate_rdserver/src/route.rs +++ b/acrate_rdserver/src/route.rs @@ -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 { 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)?;