this repo has no description
1use crate::state::AppState; 2use axum::{Json, extract::State, http::StatusCode, response::IntoResponse}; 3use serde_json::json; 4 5use tracing::error; 6 7pub async fn describe_server() -> impl IntoResponse { 8 let domains_str = 9 std::env::var("AVAILABLE_USER_DOMAINS").unwrap_or_else(|_| "example.com".to_string()); 10 let domains: Vec<&str> = domains_str.split(',').map(|s| s.trim()).collect(); 11 12 Json(json!({ 13 "availableUserDomains": domains 14 })) 15} 16 17pub async fn health(State(state): State<AppState>) -> impl IntoResponse { 18 match sqlx::query!("SELECT 1 as one").fetch_one(&state.db).await { 19 Ok(_) => (StatusCode::OK, "OK"), 20 Err(e) => { 21 error!("Health check failed: {:?}", e); 22 (StatusCode::SERVICE_UNAVAILABLE, "Service Unavailable") 23 } 24 } 25}