mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-24 08:50:40 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user