mirror of
https://github.com/Astatin3/unshell.git
synced 2026-06-08 22:38:01 -06:00
Add TOML parsing
This commit is contained in:
@@ -1,22 +1,18 @@
|
||||
mod database;
|
||||
mod manager;
|
||||
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use unshell_lib::module::Manager;
|
||||
|
||||
use crate::SERVER_CONFIG;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Server {
|
||||
pub manager: Arc<Mutex<Manager>>,
|
||||
pub config: Vec<crate::config::ComponentMetadata>,
|
||||
// pub manager: Arc<Mutex<Manager>>,
|
||||
pub db: sled::Db,
|
||||
}
|
||||
|
||||
impl Server {
|
||||
pub fn new(database: String) -> Self {
|
||||
Self {
|
||||
manager: Manager::start(&SERVER_CONFIG, Vec::new()),
|
||||
config: Vec::new(),
|
||||
// manager: Manager::start(&SERVER_CONFIG, Vec::new()),
|
||||
db: sled::open(database).expect("Failed to open database"),
|
||||
}
|
||||
}
|
||||
@@ -25,6 +21,6 @@ impl Server {
|
||||
impl Drop for Server {
|
||||
fn drop(&mut self) {
|
||||
self.db.flush().expect("Failed to flush database on drop");
|
||||
Manager::join(self.manager.clone());
|
||||
// Manager::join(self.manager.clone());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user