mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-26 02:51:07 +01:00
fix incorrect reload behaviors, further organize code
This commit is contained in:
@@ -3,6 +3,8 @@ package types
|
||||
import (
|
||||
"github.com/yusing/go-proxy/internal/net/http/accesslog"
|
||||
"github.com/yusing/go-proxy/internal/utils"
|
||||
|
||||
E "github.com/yusing/go-proxy/internal/error"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -24,6 +26,12 @@ type (
|
||||
AccessLog *accesslog.Config `json:"access_log" validate:"omitempty"`
|
||||
}
|
||||
NotificationConfig map[string]any
|
||||
|
||||
ConfigInstance interface {
|
||||
Value() *Config
|
||||
Reload() E.Error
|
||||
Statistics() map[string]any
|
||||
}
|
||||
)
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
@@ -35,6 +43,11 @@ func DefaultConfig() *Config {
|
||||
}
|
||||
}
|
||||
|
||||
func Validate(data []byte) E.Error {
|
||||
var model Config
|
||||
return utils.DeserializeYAML(data, &model)
|
||||
}
|
||||
|
||||
func init() {
|
||||
utils.RegisterDefaultValueFactory(DefaultConfig)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user