feat: add discovery
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-11-24 17:12:15 +01:00
parent c4434fd841
commit ee323e99e8
20 changed files with 1482 additions and 117 deletions

View File

@@ -1,11 +1,13 @@
use std::{ops::Deref, sync::Arc};
use crate::server::config::ServerConfig;
#[derive(Clone)]
pub struct SharedState(Arc<State>);
impl SharedState {
pub async fn new() -> anyhow::Result<Self> {
Ok(Self(Arc::new(State::new().await?)))
pub async fn new(config: ServerConfig) -> anyhow::Result<Self> {
Ok(Self(Arc::new(State::new(config).await?)))
}
}
@@ -23,10 +25,12 @@ impl Deref for SharedState {
}
}
pub struct State {}
pub struct State {
pub config: ServerConfig,
}
impl State {
pub async fn new() -> anyhow::Result<Self> {
Ok(Self {})
pub async fn new(config: ServerConfig) -> anyhow::Result<Self> {
Ok(Self { config })
}
}