create skeleton

This commit is contained in:
Aiden McClelland
2024-05-31 13:46:58 -06:00
parent fd7c2fbe93
commit 2568bfde5e
25 changed files with 508 additions and 124 deletions

View File

@@ -113,6 +113,8 @@ pub struct ServerConfig {
pub datadir: Option<PathBuf>,
#[arg(long = "disable-encryption")]
pub disable_encryption: Option<bool>,
#[arg(short = 'a', long = "analytics-url")]
pub analytics_url: Option<Url>,
}
impl ContextConfig for ServerConfig {
fn next(&mut self) -> Option<PathBuf> {
@@ -131,6 +133,7 @@ impl ContextConfig for ServerConfig {
.or(other.revision_cache_size);
self.datadir = self.datadir.take().or(other.datadir);
self.disable_encryption = self.disable_encryption.take().or(other.disable_encryption);
self.analytics_url = self.analytics_url.take().or(other.analytics_url);
}
}

View File

@@ -13,6 +13,7 @@ use rpc_toolkit::{CallRemote, Context, Empty};
use tokio::sync::{broadcast, oneshot, Mutex, RwLock};
use tokio::time::Instant;
use tracing::instrument;
use url::Url;
use super::setup::CURRENT_SECRET;
use crate::account::AccountInfo;
@@ -55,7 +56,9 @@ pub struct RpcContextSeed {
pub client: Client,
pub hardware: Hardware,
pub start_time: Instant,
#[cfg(feature = "dev")]
pub dev: Dev,
pub analytics_url: Option<Url>,
}
pub struct Dev {
@@ -184,9 +187,11 @@ impl RpcContext {
.with_kind(crate::ErrorKind::ParseUrl)?,
hardware: Hardware { devices, ram },
start_time: Instant::now(),
#[cfg(feature = "dev")]
dev: Dev {
lxc: Mutex::new(BTreeMap::new()),
},
analytics_url: config.analytics_url.clone(),
});
let res = Self(seed.clone());