mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 12:33:40 +00:00
* wip: enabling support for wireguard and firewall * wip * wip * wip * wip * wip * implement some things * fix warning * wip * alpha.23 * misc fixes * remove ufw since no longer required * remove debug info * add cli bindings * debugging * fixes * individualized acme and privacy settings for domains and bindings * sdk version bump * migration * misc fixes * refactor Host::update * debug info * refactor webserver * misc fixes * misc fixes * refactor port forwarding * recheck interfaces every 5 min if no dbus event * misc fixes and cleanup * misc fixes
55 lines
1.4 KiB
Rust
55 lines
1.4 KiB
Rust
use std::ops::Deref;
|
|
use std::sync::Arc;
|
|
|
|
use rpc_toolkit::yajrc::RpcError;
|
|
use rpc_toolkit::Context;
|
|
use tokio::sync::broadcast::Sender;
|
|
use tracing::instrument;
|
|
|
|
use crate::context::config::ServerConfig;
|
|
use crate::rpc_continuations::RpcContinuations;
|
|
use crate::shutdown::Shutdown;
|
|
use crate::Error;
|
|
|
|
pub struct DiagnosticContextSeed {
|
|
pub shutdown: Sender<Shutdown>,
|
|
pub error: Arc<RpcError>,
|
|
pub disk_guid: Option<Arc<String>>,
|
|
pub rpc_continuations: RpcContinuations,
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
pub struct DiagnosticContext(Arc<DiagnosticContextSeed>);
|
|
impl DiagnosticContext {
|
|
#[instrument(skip_all)]
|
|
pub fn init(
|
|
_config: &ServerConfig,
|
|
disk_guid: Option<Arc<String>>,
|
|
error: Error,
|
|
) -> Result<Self, Error> {
|
|
tracing::error!("Error: {}: Starting diagnostic UI", error);
|
|
tracing::debug!("{:?}", error);
|
|
|
|
let (shutdown, _) = tokio::sync::broadcast::channel(1);
|
|
|
|
Ok(Self(Arc::new(DiagnosticContextSeed {
|
|
shutdown,
|
|
disk_guid,
|
|
error: Arc::new(error.into()),
|
|
rpc_continuations: RpcContinuations::new(),
|
|
})))
|
|
}
|
|
}
|
|
impl AsRef<RpcContinuations> for DiagnosticContext {
|
|
fn as_ref(&self) -> &RpcContinuations {
|
|
&self.rpc_continuations
|
|
}
|
|
}
|
|
impl Context for DiagnosticContext {}
|
|
impl Deref for DiagnosticContext {
|
|
type Target = DiagnosticContextSeed;
|
|
fn deref(&self) -> &Self::Target {
|
|
&*self.0
|
|
}
|
|
}
|