aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-server
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@elliehuxtable.com>2024-07-02 14:13:45 +0100
committerGitHub <noreply@github.com>2024-07-02 14:13:45 +0100
commit255a7bccb6c0a7a2cd4ef24a58599aedbfc91aab (patch)
tree0e16c5dd498bb5944c1ec71b842840d77166f266 /crates/atuin-server
parentfix: add idx cache unique index (#2226) (diff)
downloadatuin-255a7bccb6c0a7a2cd4ef24a58599aedbfc91aab.zip
feat: allow advertising a fake version to clients (#2228)
* feat: allow advertising a fake version to clients The server usually runs unstable Atuin, and is well monitored. But let's not advertised the unstable version to clients, as they will notify users there is an update available. * fix test build
Diffstat (limited to 'crates/atuin-server')
-rw-r--r--crates/atuin-server/src/handlers/mod.rs8
-rw-r--r--crates/atuin-server/src/settings.rs7
2 files changed, 14 insertions, 1 deletions
diff --git a/crates/atuin-server/src/handlers/mod.rs b/crates/atuin-server/src/handlers/mod.rs
index 50f82336..ce10f4b7 100644
--- a/crates/atuin-server/src/handlers/mod.rs
+++ b/crates/atuin-server/src/handlers/mod.rs
@@ -19,10 +19,16 @@ pub async fn index<DB: Database>(state: State<AppState<DB>>) -> Json<IndexRespon
// It's super unlikely this will happen
let count = state.database.total_history().await.unwrap_or(-1);
+ let version = state
+ .settings
+ .fake_version
+ .clone()
+ .unwrap_or(VERSION.to_string());
+
Json(IndexResponse {
homage: homage.to_string(),
- version: VERSION.to_string(),
total_history: count,
+ version,
})
}
diff --git a/crates/atuin-server/src/settings.rs b/crates/atuin-server/src/settings.rs
index dfe238d6..c62c65b8 100644
--- a/crates/atuin-server/src/settings.rs
+++ b/crates/atuin-server/src/settings.rs
@@ -67,6 +67,13 @@ pub struct Settings<DbSettings> {
pub tls: Tls,
pub mail: Mail,
+ /// Advertise a version that is not what we are _actually_ running
+ /// Many clients compare their version with api.atuin.sh, and if they differ, notify the user
+ /// that an update is available.
+ /// Now that we take beta releases, we should be able to advertise a different version to avoid
+ /// notifying users when the server runs something that is not a stable release.
+ pub fake_version: Option<String>,
+
#[serde(flatten)]
pub db_settings: DbSettings,
}