2022-02-23 06:37:52 +00:00
|
|
|
package paramtable
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
|
|
|
type HTTPConfig struct {
|
|
|
|
BaseTable
|
|
|
|
|
2022-06-24 07:34:14 +00:00
|
|
|
once sync.Once
|
|
|
|
Enabled bool
|
|
|
|
DebugMode bool
|
2022-02-23 06:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// InitOnce initialize HTTPConfig
|
|
|
|
func (p *HTTPConfig) InitOnce() {
|
|
|
|
p.once.Do(func() {
|
|
|
|
p.init()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *HTTPConfig) init() {
|
|
|
|
p.BaseTable.Init()
|
|
|
|
|
|
|
|
p.initHTTPEnabled()
|
2022-04-29 07:15:47 +00:00
|
|
|
p.initHTTPDebugMode()
|
2022-02-23 06:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *HTTPConfig) initHTTPEnabled() {
|
|
|
|
p.Enabled = p.ParseBool("proxy.http.enabled", true)
|
|
|
|
}
|
|
|
|
|
2022-04-29 07:15:47 +00:00
|
|
|
func (p *HTTPConfig) initHTTPDebugMode() {
|
|
|
|
p.DebugMode = p.ParseBool("proxy.http.debug_mode", false)
|
|
|
|
}
|