refactor(encoding): rename new codec registries

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar 2024-06-24 11:52:02 +02:00 committed by Márk Sági-Kazár
parent a7f64b7f25
commit 8492c8d451
1 changed files with 6 additions and 6 deletions

View File

@ -184,8 +184,8 @@ type Viper struct {
logger *slog.Logger logger *slog.Logger
encoderRegistry2 EncoderRegistry encoderRegistry EncoderRegistry
decoderRegistry2 DecoderRegistry decoderRegistry DecoderRegistry
experimentalFinder bool experimentalFinder bool
experimentalBindStruct bool experimentalBindStruct bool
@ -211,8 +211,8 @@ func New() *Viper {
codecRegistry := codecRegistry{v: v} codecRegistry := codecRegistry{v: v}
v.encoderRegistry2 = codecRegistry v.encoderRegistry = codecRegistry
v.decoderRegistry2 = codecRegistry v.decoderRegistry = codecRegistry
v.experimentalFinder = features.Finder v.experimentalFinder = features.Finder
v.experimentalBindStruct = features.BindStruct v.experimentalBindStruct = features.BindStruct
@ -1623,7 +1623,7 @@ func (v *Viper) unmarshalReader(in io.Reader, c map[string]any) error {
switch format := strings.ToLower(v.getConfigType()); format { switch format := strings.ToLower(v.getConfigType()); format {
case "yaml", "yml", "json", "toml", "hcl", "tfvars", "ini", "properties", "props", "prop", "dotenv", "env": case "yaml", "yml", "json", "toml", "hcl", "tfvars", "ini", "properties", "props", "prop", "dotenv", "env":
decoder, err := v.decoderRegistry2.Decoder(format) decoder, err := v.decoderRegistry.Decoder(format)
if err != nil { if err != nil {
return ConfigParseError{err} return ConfigParseError{err}
} }
@ -1643,7 +1643,7 @@ func (v *Viper) marshalWriter(f afero.File, configType string) error {
c := v.AllSettings() c := v.AllSettings()
switch configType { switch configType {
case "yaml", "yml", "json", "toml", "hcl", "tfvars", "ini", "prop", "props", "properties", "dotenv", "env": case "yaml", "yml", "json", "toml", "hcl", "tfvars", "ini", "prop", "props", "properties", "dotenv", "env":
encoder, err := v.encoderRegistry2.Encoder(configType) encoder, err := v.encoderRegistry.Encoder(configType)
if err != nil { if err != nil {
return ConfigMarshalError{err} return ConfigMarshalError{err}
} }