Skip to content

Commit

Permalink
#215 make atomic-server also a library
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Nov 20, 2021
1 parent 7371dcd commit 9b4049f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
8 changes: 8 additions & 0 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ name = "atomic-server"
repository = "https://github.com/joepio/atomic-data-rust"
version = "0.28.2"

[lib]
name = "atomic_server_lib"
path = "src/lib.rs"

[[bin]]
name = "atomic_server"
path = "src/bin.rs"

[dependencies]
actix = "0.10.0"
actix-cors = "0.5.4"
Expand Down
12 changes: 6 additions & 6 deletions server/src/main.rs → server/src/bin.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use atomic_lib::{errors::AtomicResult, Storelike};
use std::{fs::File, io::Write};

mod actor_messages;
mod appstate;
mod commit_monitor;
mod config;
pub mod config;
mod content_types;
mod errors;
mod handlers;
Expand All @@ -11,17 +14,14 @@ mod https;
mod jsonerrors;
mod process;
mod routes;
pub mod serve;
// #[cfg(feature = "search")]
mod search;
mod serve;
#[cfg(test)]
mod tests;
#[cfg(feature = "desktop")]
mod tray_icon;

use atomic_lib::{errors::AtomicResult, Storelike};
use std::{fs::File, io::Write};

#[actix_web::main]
async fn main() -> AtomicResult<()> {
// Parse CLI commands, env vars
Expand Down Expand Up @@ -78,6 +78,6 @@ async fn main() -> AtomicResult<()> {
println!("Sucesfully created {}", pathstr);
Ok(())
}
None => crate::serve::serve(config).await,
None => serve::serve(&config).await,
}
}
20 changes: 20 additions & 0 deletions server/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
mod actor_messages;
mod appstate;
mod commit_monitor;
pub mod config;
mod content_types;
mod errors;
mod handlers;
mod helpers;
#[cfg(feature = "https")]
mod https;
mod jsonerrors;
mod process;
mod routes;
pub mod serve;
// #[cfg(feature = "search")]
mod search;
#[cfg(test)]
mod tests;
#[cfg(feature = "desktop")]
mod tray_icon;
6 changes: 5 additions & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
license = ""
name = "app"
repository = ""
version = "0.1.0"
version = "0.28.3"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -19,6 +19,10 @@ serde = {version = "1.0", features = ["derive"] }
serde_json = "1.0"
tauri = {version = "1.0.0-beta.8", features = ["api-all", "system-tray"] }

[dependencies.atomic-server]
path = "../server"
version = "0.28.2"

[features]
custom-protocol = ["tauri/custom-protocol"]
default = ["custom-protocol"]

0 comments on commit 9b4049f

Please sign in to comment.