refactor: add disable_dashboard option and disable dashboard in metasrv and datanode (#1343)

* refactor: add disable_dashboard option and disable dashboard in metasrv and datanode

* refactor: skip disable_dashboard filed in toml file

* refactor: simplify the http initialization
This commit is contained in:
zyy17
2023-04-07 16:45:25 +08:00
committed by GitHub
parent f8b6a6b219
commit 554a69ea54
4 changed files with 30 additions and 5 deletions

View File

@@ -118,8 +118,12 @@ pub struct HttpServer {
#[serde(default)]
pub struct HttpOptions {
pub addr: String,
#[serde(with = "humantime_serde")]
pub timeout: Duration,
#[serde(skip)]
pub disable_dashboard: bool,
}
impl Default for HttpOptions {
@@ -127,6 +131,7 @@ impl Default for HttpOptions {
Self {
addr: "127.0.0.1:4000".to_string(),
timeout: Duration::from_secs(30),
disable_dashboard: false,
}
}
}
@@ -502,7 +507,10 @@ impl HttpServer {
#[cfg(feature = "dashboard")]
{
router = router.nest("/dashboard", dashboard::dashboard());
if !self.options.disable_dashboard {
info!("Enable dashboard service at '/dashboard'");
router = router.nest("/dashboard", dashboard::dashboard());
}
}
router