use axum::{extract::State, response::IntoResponse};
use magnetar_common::config::MagnetarConfig;
use magnetar_host_meta::Xrd;

use crate::web::extractors::XrdXmlExt;

pub async fn handle_host_meta(State(config): State<&'static MagnetarConfig>) -> impl IntoResponse {
    XrdXmlExt(magnetar_host_meta::XrdXml::Xrd(Xrd::default_host_meta(
        config.networking.protocol.as_ref(),
        &config.networking.host,
    )))
}
