mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Factor replica and sync configuration into simple owned structs
This commit is contained in:
parent
87596bb1f0
commit
8af7ba286d
16 changed files with 81 additions and 23 deletions
|
@ -1,3 +1,6 @@
|
|||
use crate::ServerConfig;
|
||||
use failure::Fallible;
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod test;
|
||||
|
||||
|
@ -8,3 +11,12 @@ mod types;
|
|||
pub use local::LocalServer;
|
||||
pub use remote::RemoteServer;
|
||||
pub use types::*;
|
||||
|
||||
pub fn from_config(config: ServerConfig) -> Fallible<Box<dyn Server>> {
|
||||
Ok(match config {
|
||||
ServerConfig::Local { server_dir } => Box::new(LocalServer::new(server_dir)?),
|
||||
ServerConfig::Remote { origin, client_id } => {
|
||||
Box::new(RemoteServer::new(origin, client_id))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue