diff --git a/internal/config/models.go b/internal/config/models.go index ebb2b95..55355cb 100644 --- a/internal/config/models.go +++ b/internal/config/models.go @@ -30,8 +30,9 @@ type ( ) type SettingsConf struct { - Basic BasicConf `json:"basic" yaml:"basic"` - Guardian GuardianConf `json:"guardian" yaml:"guardian"` - Log LogConf `json:"log" yaml:"log"` - DDNS DdnsConf `json:"ddns" yaml:"ddns"` + Basic BasicConf `json:"basic" yaml:"basic"` + Guardian GuardianConf `json:"guardian" yaml:"guardian"` + Log LogConf `json:"log" yaml:"log"` + DDNS DdnsConf `json:"ddns" yaml:"ddns"` + CustomHeader map[string]interface{} `json:"custom_header" yaml:"custom_header"` } diff --git a/internal/config/reader.go b/internal/config/reader.go index f378b5e..577c5ba 100644 --- a/internal/config/reader.go +++ b/internal/config/reader.go @@ -1,6 +1,7 @@ package config import ( + "bytes" "encoding/json" log "github.com/sirupsen/logrus" "gopkg.in/yaml.v3" @@ -31,7 +32,9 @@ func (Json) Marshal(v any) ([]byte, error) { return json.MarshalIndent(v, "", " ") } func (Json) Unmarshal(data []byte, v any) error { - return json.Unmarshal(data, v) + jsonDecoder := json.NewDecoder(bytes.NewReader(data)) + jsonDecoder.UseNumber() + return jsonDecoder.Decode(v) } type Yaml struct {