aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-server/src/router.rs
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@atuin.sh>2025-12-18 23:11:47 -0500
committerGitHub <noreply@github.com>2025-12-18 23:11:47 -0500
commit39ef6e79d71ea0a02022d263b9670eb474d621f4 (patch)
treed256493c051e3d9ed9758499a344e01e10638ba8 /crates/atuin-server/src/router.rs
parentfeat: add support for read replicas to postgres (#3029) (diff)
downloadatuin-39ef6e79d71ea0a02022d263b9670eb474d621f4.zip
feat: allow disabling sync v1 (#3030)
It takes up a very large amount of our query time, despite having been replaced for >1yr now. We will be dropping support for it on atuin hub
Diffstat (limited to 'crates/atuin-server/src/router.rs')
-rw-r--r--crates/atuin-server/src/router.rs23
1 files changed, 15 insertions, 8 deletions
diff --git a/crates/atuin-server/src/router.rs b/crates/atuin-server/src/router.rs
index 1118ab29..9d4f7d44 100644
--- a/crates/atuin-server/src/router.rs
+++ b/crates/atuin-server/src/router.rs
@@ -109,15 +109,22 @@ pub struct AppState<DB: Database> {
}
pub fn router<DB: Database>(database: DB, settings: Settings) -> Router {
- let routes = Router::new()
+ let mut routes = Router::new()
.route("/", get(handlers::index))
- .route("/healthz", get(handlers::health::health_check))
- .route("/sync/count", get(handlers::history::count))
- .route("/sync/history", get(handlers::history::list))
- .route("/sync/calendar/:focus", get(handlers::history::calendar))
- .route("/sync/status", get(handlers::status::status))
- .route("/history", post(handlers::history::add))
- .route("/history", delete(handlers::history::delete))
+ .route("/healthz", get(handlers::health::health_check));
+
+ // Sync v1 routes - can be disabled in favor of record-based sync
+ if settings.sync_v1_enabled {
+ routes = routes
+ .route("/sync/count", get(handlers::history::count))
+ .route("/sync/history", get(handlers::history::list))
+ .route("/sync/calendar/:focus", get(handlers::history::calendar))
+ .route("/sync/status", get(handlers::status::status))
+ .route("/history", post(handlers::history::add))
+ .route("/history", delete(handlers::history::delete));
+ }
+
+ let routes = routes
.route("/user/:username", get(handlers::user::get))
.route("/account", delete(handlers::user::delete))
.route("/account/password", patch(handlers::user::change_password))