mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
enhance: Make Web UI toggleable via config (#42814)
issue: #42813 --------- Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
This commit is contained in:
parent
6bebb68727
commit
d122e6d1e2
@ -354,6 +354,7 @@ proxy:
|
||||
hstsMaxAge: 31536000 # Strict-Transport-Security max-age in seconds
|
||||
hstsIncludeSubDomains: false # Include subdomains in Strict-Transport-Security
|
||||
enableHSTS: false # Whether to enable setting the Strict-Transport-Security header
|
||||
enableWebUI: true # Whether to enable setting the WebUI middleware on the metrics port
|
||||
ip: # TCP/IP address of proxy. If not specified, use the first unicastable address
|
||||
port: 19530 # TCP port of proxy
|
||||
internalPort: 19529
|
||||
|
||||
@ -103,8 +103,10 @@ func registerDefaults() {
|
||||
Handler: GetStaticHandler(),
|
||||
})
|
||||
|
||||
if paramtable.Get().HTTPCfg.EnableWebUI.GetAsBool() {
|
||||
RegisterWebUIHandler()
|
||||
}
|
||||
}
|
||||
|
||||
func RegisterStopComponent(triggerComponentStop func(role string) error) {
|
||||
// register restful api to trigger stop
|
||||
|
||||
@ -26,6 +26,7 @@ type httpConfig struct {
|
||||
HSTSMaxAge ParamItem `refreshable:"false"`
|
||||
HSTSIncludeSubDomains ParamItem `refreshable:"false"`
|
||||
EnableHSTS ParamItem `refreshable:"false"`
|
||||
EnableWebUI ParamItem `refreshable:"false"`
|
||||
}
|
||||
|
||||
func (p *httpConfig) init(base *BaseTable) {
|
||||
@ -110,4 +111,13 @@ func (p *httpConfig) init(base *BaseTable) {
|
||||
Export: true,
|
||||
}
|
||||
p.EnableHSTS.Init(base.mgr)
|
||||
|
||||
p.EnableWebUI = ParamItem{
|
||||
Key: "proxy.http.enableWebUI",
|
||||
DefaultValue: "true",
|
||||
Version: "v2.5.14",
|
||||
Doc: "Whether to enable setting the WebUI middleware on the metrics port",
|
||||
Export: true,
|
||||
}
|
||||
p.EnableWebUI.Init(base.mgr)
|
||||
}
|
||||
|
||||
@ -31,4 +31,5 @@ func TestHTTPConfig_Init(t *testing.T) {
|
||||
assert.Equal(t, cfg.Port.GetValue(), "")
|
||||
assert.Equal(t, cfg.AcceptTypeAllowInt64.GetValue(), "true")
|
||||
assert.Equal(t, cfg.EnablePprof.GetAsBool(), true)
|
||||
assert.Equal(t, cfg.EnableWebUI.GetAsBool(), true)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user