mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore] bump golang.org/x/net@v0.38.0, github.com/gin-contrib/cors@v1.7.4, github.com/spf13/viper@v1.20.1, github.com/tdewolff/minify/v2@v2.22.4 (#3959)
This commit is contained in:
32
vendor/github.com/spf13/viper/viper.go
generated
vendored
32
vendor/github.com/spf13/viper/viper.go
generated
vendored
@ -1535,27 +1535,29 @@ func (v *Viper) MergeInConfig() error {
|
||||
func ReadConfig(in io.Reader) error { return v.ReadConfig(in) }
|
||||
|
||||
func (v *Viper) ReadConfig(in io.Reader) error {
|
||||
if v.configType == "" {
|
||||
return errors.New("cannot decode configuration: config type is not set")
|
||||
config := make(map[string]any)
|
||||
|
||||
err := v.unmarshalReader(in, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
v.config = make(map[string]any)
|
||||
return v.unmarshalReader(in, v.config)
|
||||
v.config = config
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MergeConfig merges a new configuration with an existing config.
|
||||
func MergeConfig(in io.Reader) error { return v.MergeConfig(in) }
|
||||
|
||||
func (v *Viper) MergeConfig(in io.Reader) error {
|
||||
if v.configType == "" {
|
||||
return errors.New("cannot decode configuration: config type is not set")
|
||||
}
|
||||
config := make(map[string]any)
|
||||
|
||||
cfg := make(map[string]any)
|
||||
if err := v.unmarshalReader(in, cfg); err != nil {
|
||||
if err := v.unmarshalReader(in, config); err != nil {
|
||||
return err
|
||||
}
|
||||
return v.MergeConfigMap(cfg)
|
||||
|
||||
return v.MergeConfigMap(config)
|
||||
}
|
||||
|
||||
// MergeConfigMap merges the configuration from the map given with an existing config.
|
||||
@ -1662,15 +1664,21 @@ func (v *Viper) writeConfig(filename string, force bool) error {
|
||||
}
|
||||
|
||||
func (v *Viper) unmarshalReader(in io.Reader, c map[string]any) error {
|
||||
format := strings.ToLower(v.getConfigType())
|
||||
if format == "" {
|
||||
return errors.New("cannot decode configuration: unable to determine config type")
|
||||
}
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
buf.ReadFrom(in)
|
||||
|
||||
format := strings.ToLower(v.getConfigType())
|
||||
|
||||
// TODO: remove this once SupportedExts is deprecated/removed
|
||||
if !slices.Contains(SupportedExts, format) {
|
||||
return UnsupportedConfigError(format)
|
||||
}
|
||||
|
||||
// TODO: return [UnsupportedConfigError] if the registry does not contain the format
|
||||
// TODO: consider deprecating this error type
|
||||
decoder, err := v.decoderRegistry.Decoder(format)
|
||||
if err != nil {
|
||||
return ConfigParseError{err}
|
||||
|
Reference in New Issue
Block a user