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 17
17
*/
18
18
19
19
use actix_web:: web:: Json ;
20
+ use human_size:: SpecificSize ;
20
21
use serde_json:: json;
21
22
22
23
use crate :: { about, option:: CONFIG , storage:: StorageMetadata , utils:: update} ;
24
+ use std:: path:: PathBuf ;
23
25
24
26
pub async fn about ( ) -> Json < serde_json:: Value > {
25
27
let meta = StorageMetadata :: global ( ) ;
@@ -48,6 +50,21 @@ pub async fn about() -> Json<serde_json::Value> {
48
50
let is_oidc_active = CONFIG . parseable . openid . is_some ( ) ;
49
51
let ui_version = option_env ! ( "UI_VERSION" ) . unwrap_or ( "development" ) ;
50
52
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
+
51
68
Json ( json ! ( {
52
69
"version" : current_version,
53
70
"uiVersion" : ui_version,
@@ -61,6 +78,7 @@ pub async fn about() -> Json<serde_json::Value> {
61
78
"license" : "AGPL-3.0-only" ,
62
79
"mode" : mode,
63
80
"staging" : staging,
81
+ "cache" : cache_details,
64
82
"grpcPort" : grpc_port,
65
83
"store" : store
66
84
} ) )
Original file line number Diff line number Diff line change @@ -112,6 +112,14 @@ impl Config {
112
112
& self . parseable . local_staging_path
113
113
}
114
114
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
+
115
123
pub fn is_default_creds ( & self ) -> bool {
116
124
self . parseable . username == Server :: DEFAULT_USERNAME
117
125
&& self . parseable . password == Server :: DEFAULT_PASSWORD
You can’t perform that action at this time.
0 commit comments