connect masters

This commit is contained in:
yggverse 2026-03-05 16:08:31 +02:00
parent af0c69c4c5
commit 204b64a4f9
3 changed files with 9 additions and 4 deletions

View file

@ -1,12 +1,13 @@
use serde::Deserialize; use serde::Deserialize;
use std::net::IpAddr; use std::net::{IpAddr, SocketAddr};
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct Config { pub struct Config {
pub title: String, pub debug: bool,
pub description: Option<String>, pub description: Option<String>,
pub format_time: String, pub format_time: String,
pub host: IpAddr, pub host: IpAddr,
pub masters: Vec<SocketAddr>,
pub port: u16, pub port: u16,
pub debug: bool, pub title: String,
} }

View file

@ -4,4 +4,5 @@ use rocket::serde::Serialize;
#[serde(crate = "rocket::serde")] #[serde(crate = "rocket::serde")]
pub struct Global { pub struct Global {
pub format_time: String, pub format_time: String,
pub masters: Vec<std::net::SocketAddr>,
} }

View file

@ -23,8 +23,10 @@ fn index(meta: &State<Meta>, global: &State<Global>) -> Result<Template, Status>
Ok(Template::render( Ok(Template::render(
"index", "index",
context! { context! {
title: &meta.title, masters: &global.masters,
servers: servers, servers: servers,
title: &meta.title,
version: &meta.version,
}, },
)) ))
} }
@ -48,6 +50,7 @@ fn rocket() -> _ {
}) })
.manage(Global { .manage(Global {
format_time: config.format_time, format_time: config.format_time,
masters: config.masters,
}) })
.manage(Meta { .manage(Meta {
description: config.description, description: config.description,