// Basic handler for getting meta data about the server use std::env::var; use hyper::{Response, Body}; use serde_json::to_string; use serde::Serialize; #[derive( Serialize)] pub struct Config { pub name: String, pub description: String, pub url: String, pub wsurl: String, } pub fn get_config() -> Config { Config { name: var("SERVER_NAME").unwrap_or("No name".into()), description: var("SERVER_DESCRIPTION").unwrap_or("No description".into()), url: var("PUBLIC_URL").unwrap(), wsurl: var("PUBLIC_WS_URL").unwrap() } } pub async fn server_meta(response: &mut Response) { *response.body_mut() = Body::from(to_string(&get_config()).unwrap()); }