Support creating a standalone sync server
This commit is contained in:
parent
0f77de896d
commit
8c712cd118
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -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"
|
||||
|
@ -14,6 +14,7 @@ members = [
|
||||
"rslib/proto",
|
||||
"rslib/io",
|
||||
"rslib/process",
|
||||
"rslib/sync",
|
||||
"pylib/rsbridge",
|
||||
"build/configure",
|
||||
"build/ninja_gen",
|
||||
|
16
rslib/sync/Cargo.toml
Normal file
16
rslib/sync/Cargo.toml
Normal file
@ -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
|
14
rslib/sync/main.rs
Normal file
14
rslib/sync/main.rs
Normal file
@ -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());
|
||||
}
|
Loading…
Reference in New Issue
Block a user