Improve configuration merge

This commit is contained in:
世界
2023-12-10 22:57:28 +08:00
parent 3afc8d815c
commit 5a235dff20
2 changed files with 10 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ import (
)
type _Options struct {
RawMessage json.RawMessage `json:"-"`
Schema string `json:"$schema,omitempty"`
Log *LogOptions `json:"log,omitempty"`
DNS *DNSOptions `json:"dns,omitempty"`
@@ -26,6 +27,7 @@ func (o *Options) UnmarshalJSON(content []byte) error {
decoder.DisallowUnknownFields()
err := decoder.Decode((*_Options)(o))
if err == nil {
o.RawMessage = content
return nil
}
if syntaxError, isSyntaxError := err.(*json.SyntaxError); isSyntaxError {