Skip to content

Commit

Permalink
Update /about API (parseablehq#705)
Browse files Browse the repository at this point in the history
add + update about api

1. Add About API for Ingest Servers
2. Update About API Response

```
{
    "version": current_version,
    "uiVersion": ui_version,
    "commit": commit,
    "deploymentId": deployment_id,
    "updateAvailable": update_available,
    "latestVersion": latest_release,
    "llmActive": is_llm_active,
    "llmProvider": llm_provider,
    "oidcActive": is_oidc_active,
    "license": "AGPL-3.0-only",
    "mode": mode,
    "staging": staging,
    "cache": cache_details,
    "grpcPort": grpc_port,
    "store": {
        "type": CONFIG.get_storage_mode_string(),
        "path": store_endpoint
    }
}
```
  • Loading branch information
Eshanatnight committed Apr 1, 2024
1 parent ae61abd commit 461a2ec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
22 changes: 17 additions & 5 deletions server/src/handlers/http/about.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ use actix_web::web::Json;
use human_size::SpecificSize;
use serde_json::json;

use crate::{about, option::CONFIG, storage::StorageMetadata, utils::update};
use crate::{
about,
option::{Mode, CONFIG},
storage::StorageMetadata,
utils::update,
};
use std::path::PathBuf;

pub async fn about() -> Json<serde_json::Value> {
Expand All @@ -40,11 +45,15 @@ pub async fn about() -> Json<serde_json::Value> {
let current_version = format!("v{}", current_release.released_version);
let commit = current_release.commit_hash;
let deployment_id = meta.deployment_id.to_string();
let mode = CONFIG.get_storage_mode_string();
let staging = CONFIG.staging_dir();
let mode = CONFIG.parseable.mode.to_str();
let staging = if CONFIG.parseable.mode == Mode::Query {
"".to_string()
} else {
CONFIG.staging_dir().display().to_string()
};
let grpc_port = CONFIG.parseable.grpc_port;

let store = CONFIG.storage().get_endpoint();
let store_endpoint = 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 is_oidc_active = CONFIG.parseable.openid.is_some();
Expand Down Expand Up @@ -80,6 +89,9 @@ pub async fn about() -> Json<serde_json::Value> {
"staging": staging,
"cache": cache_details,
"grpcPort": grpc_port,
"store": store
"store": {
"type": CONFIG.get_storage_mode_string(),
"path": store_endpoint
}
}))
}
3 changes: 2 additions & 1 deletion server/src/handlers/http/modal/ingest_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ impl IngestServer {
web::scope(&base_path())
.service(Server::get_query_factory())
.service(Server::get_ingest_factory())
.service(Self::logstream_api()),
.service(Self::logstream_api())
.service(Server::get_about_factory()),
)
.service(Server::get_liveness_factory())
.service(Server::get_readiness_factory())
Expand Down

0 comments on commit 461a2ec

Please sign in to comment.