mirror of
https://github.com/atuinsh/atuin.git
synced 2025-06-21 10:28:50 +02:00
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
This commit is contained in:
parent
884d97d55e
commit
255a7bccb6
@ -19,10 +19,16 @@ pub async fn index<DB: Database>(state: State<AppState<DB>>) -> Json<IndexRespon
|
|||||||
// It's super unlikely this will happen
|
// It's super unlikely this will happen
|
||||||
let count = state.database.total_history().await.unwrap_or(-1);
|
let count = state.database.total_history().await.unwrap_or(-1);
|
||||||
|
|
||||||
|
let version = state
|
||||||
|
.settings
|
||||||
|
.fake_version
|
||||||
|
.clone()
|
||||||
|
.unwrap_or(VERSION.to_string());
|
||||||
|
|
||||||
Json(IndexResponse {
|
Json(IndexResponse {
|
||||||
homage: homage.to_string(),
|
homage: homage.to_string(),
|
||||||
version: VERSION.to_string(),
|
|
||||||
total_history: count,
|
total_history: count,
|
||||||
|
version,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +67,13 @@ pub struct Settings<DbSettings> {
|
|||||||
pub tls: Tls,
|
pub tls: Tls,
|
||||||
pub mail: Mail,
|
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)]
|
#[serde(flatten)]
|
||||||
pub db_settings: DbSettings,
|
pub db_settings: DbSettings,
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ pub async fn start_server(path: &str) -> (String, oneshot::Sender<()>, JoinHandl
|
|||||||
metrics: atuin_server::settings::Metrics::default(),
|
metrics: atuin_server::settings::Metrics::default(),
|
||||||
tls: atuin_server::settings::Tls::default(),
|
tls: atuin_server::settings::Tls::default(),
|
||||||
mail: atuin_server::settings::Mail::default(),
|
mail: atuin_server::settings::Mail::default(),
|
||||||
|
fake_version: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let (shutdown_tx, shutdown_rx) = tokio::sync::oneshot::channel();
|
let (shutdown_tx, shutdown_rx) = tokio::sync::oneshot::channel();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user