File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1717 */
1818
1919use actix_web:: web:: Json ;
20+ use human_size:: SpecificSize ;
2021use serde_json:: json;
2122
2223use crate :: { about, option:: CONFIG , storage:: StorageMetadata , utils:: update} ;
24+ use std:: path:: PathBuf ;
2325
2426pub async fn about ( ) -> Json < serde_json:: Value > {
2527 let meta = StorageMetadata :: global ( ) ;
@@ -48,6 +50,21 @@ pub async fn about() -> Json<serde_json::Value> {
4850 let is_oidc_active = CONFIG . parseable . openid . is_some ( ) ;
4951 let ui_version = option_env ! ( "UI_VERSION" ) . unwrap_or ( "development" ) ;
5052
53+ let cache_details: String = if CONFIG . cache_dir ( ) . is_none ( ) {
54+ "Disabled" . to_string ( )
55+ } else {
56+ let cache_dir: & Option < PathBuf > = CONFIG . cache_dir ( ) ;
57+ let cache_size: SpecificSize < human_size:: Gigibyte > =
58+ SpecificSize :: new ( CONFIG . cache_size ( ) as f64 , human_size:: Byte )
59+ . unwrap ( )
60+ . into ( ) ;
61+ format ! (
62+ "Enabled, Path: {} (Size: {})" ,
63+ cache_dir. as_ref( ) . unwrap( ) . display( ) ,
64+ cache_size
65+ )
66+ } ;
67+
5168 Json ( json ! ( {
5269 "version" : current_version,
5370 "uiVersion" : ui_version,
@@ -61,6 +78,7 @@ pub async fn about() -> Json<serde_json::Value> {
6178 "license" : "AGPL-3.0-only" ,
6279 "mode" : mode,
6380 "staging" : staging,
81+ "cache" : cache_details,
6482 "grpcPort" : grpc_port,
6583 "store" : store
6684 } ) )
Original file line number Diff line number Diff line change @@ -112,6 +112,14 @@ impl Config {
112112 & self . parseable . local_staging_path
113113 }
114114
115+ pub fn cache_size ( & self ) -> u64 {
116+ self . parseable . local_cache_size
117+ }
118+
119+ pub fn cache_dir ( & self ) -> & Option < PathBuf > {
120+ & self . parseable . local_cache_path
121+ }
122+
115123 pub fn is_default_creds ( & self ) -> bool {
116124 self . parseable . username == Server :: DEFAULT_USERNAME
117125 && self . parseable . password == Server :: DEFAULT_PASSWORD
You can’t perform that action at this time.
0 commit comments