Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch ui version from Cargo toml #518

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ static-files = "0.2"
ureq = "2.6"
vergen = { version = "8.1", features = ["build", "git", "cargo", "gitcl"] }
zip = { version = "0.6", default_features = false, features = ["deflate"] }
url = "2.4.0"

[dev-dependencies]
maplit = "1.0"
Expand Down
11 changes: 11 additions & 0 deletions server/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ mod ui {
file.write_all(checksum.as_bytes())?;
file.flush()?;

if local_assets_path.is_none() {
// emit ui version for asset url
let url = url::Url::parse(url).expect("valid url");
let ui_version = url
.path_segments()
.expect("has segemnts")
.find(|v| v.starts_with('v'))
.expect("version segement");
println!("cargo:rustc-env=UI_VERSION={}", ui_version);
}

Ok(())
}
}
2 changes: 2 additions & 0 deletions server/src/handlers/http/about.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ pub async fn about() -> Json<serde_json::Value> {
let store = CONFIG.storage().get_endpoint();
let is_llm_active = &CONFIG.parseable.open_ai_key.is_some();
let llm_provider = is_llm_active.then_some("OpenAI");
let ui_version = option_env!("UI_VERSION");

Json(json!({
"version": current_version,
"uiVersion": ui_version,
trueleo marked this conversation as resolved.
Show resolved Hide resolved
"commit": commit,
"deploymentId": deployment_id,
"updateAvailable": update_available,
Expand Down
Loading