Compare commits

..

No commits in common. "ab444e07f41476add9c3cb70f20f8ad94399050f" and "475accc50cad799af39bfe9339001ef2258b54d9" have entirely different histories.

3 changed files with 3 additions and 13 deletions

2
Cargo.lock generated
View file

@ -740,7 +740,7 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
[[package]]
name = "kosyncrs"
version = "2.0.0"
version = "1.1.1"
dependencies = [
"axum",
"serde",

View file

@ -39,15 +39,12 @@ pub struct GetProgress {
timestamp: i64,
}
const VERSION: &str = env!("CARGO_PKG_VERSION");
#[tokio::main]
async fn main() {
let pg_url: String = env::var("PG_URL")
.ok()
.and_then(|v| v.parse().ok())
.unwrap();
let listen_port: String = env::var("PORT").ok().and_then(|v| v.parse().ok()).unwrap();
let db_pool = PgPoolOptions::new()
.max_connections(64)
@ -64,12 +61,10 @@ async fn main() {
.route("/syncs/progress", put(update_progress))
.route("/syncs/progress/{document}", get(get_progress))
.route("/healthcheck", get(healthcheck))
.route("/version", get(version))
.with_state(db_pool);
let mut bind_with = "127.0.0.1:".to_owned();
bind_with += &listen_port;
let listener = tokio::net::TcpListener::bind(bind_with)
// run it with hyper on localhost:3003
let listener = tokio::net::TcpListener::bind("127.0.0.1:3003")
.await
.unwrap();
axum::serve(listener, app).await.unwrap();
@ -79,10 +74,6 @@ async fn root() -> &'static str {
"KOreader sync server"
}
async fn version() -> &'static str {
VERSION
}
async fn create_user(
State(db_pool): State<PgPool>,
Json(payload): Json<User>,

View file

@ -12,7 +12,6 @@ Group=users
WorkingDirectory=/home/myuser
ExecStart=/usr/local/bin/kosyncrs
Environment="PG_URL=postgresql://kosync:password@localhost/kosync"
Environment="PORT=3003"
Restart=always
[Install]