diff --git a/Cargo.lock b/Cargo.lock index 026ed57c7..5ee5495e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -164,6 +164,13 @@ dependencies = [ "zstd", ] +[[package]] +name = "anki-sync-server" +version = "0.0.0" +dependencies = [ + "anki", +] + [[package]] name = "anki_i18n" version = "0.0.0" diff --git a/Cargo.toml b/Cargo.toml index 68e92b477..1fbf91f14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ members = [ "rslib/proto", "rslib/io", "rslib/process", + "rslib/sync", "pylib/rsbridge", "build/configure", "build/ninja_gen", diff --git a/rslib/sync/Cargo.toml b/rslib/sync/Cargo.toml new file mode 100644 index 000000000..e2d960503 --- /dev/null +++ b/rslib/sync/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "anki-sync-server" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +publish = false +rust-version.workspace = true +description = "Standalone sync server" + +[[bin]] +path = "main.rs" +name = "anki-sync-server" + +[dependencies] +anki.workspace = true diff --git a/rslib/sync/main.rs b/rslib/sync/main.rs new file mode 100644 index 000000000..80fd3007b --- /dev/null +++ b/rslib/sync/main.rs @@ -0,0 +1,14 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html +use std::env; + +use anki::log::set_global_logger; +use anki::sync::http_server::SimpleServer; + +fn main() { + if env::var("RUST_LOG").is_err() { + env::set_var("RUST_LOG", "anki=info") + } + set_global_logger(None).unwrap(); + println!("{}", SimpleServer::run()); +}