Skip to content

Commit acd965b

Browse files
gandarezsagikazarmark
authored andcommitted
Add ini load options argument
Signed-off-by: Mark Sagi-Kazar <[email protected]>
1 parent 5f4d053 commit acd965b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

viper.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ type Viper struct {
199199
configPermissions os.FileMode
200200
envPrefix string
201201

202+
// Specific commands for ini parsing
203+
iniLoadOptions ini.LoadOptions
204+
202205
automaticEnvApplied bool
203206
envKeyReplacer StringReplacer
204207
allowEmptyEnv bool
@@ -1637,7 +1640,7 @@ func (v *Viper) unmarshalReader(in io.Reader, c map[string]interface{}) error {
16371640
}
16381641

16391642
case "ini":
1640-
cfg := ini.Empty()
1643+
cfg := ini.Empty(v.iniLoadOptions)
16411644
err := cfg.Append(buf.Bytes())
16421645
if err != nil {
16431646
return ConfigParseError{err}
@@ -2081,6 +2084,13 @@ func (v *Viper) SetConfigPermissions(perm os.FileMode) {
20812084
v.configPermissions = perm.Perm()
20822085
}
20832086

2087+
// IniLoadOptions sets the load options for ini parsing.
2088+
func IniLoadOptions(in ini.LoadOptions) Option {
2089+
return optionFunc(func(v *Viper) {
2090+
v.iniLoadOptions = in
2091+
})
2092+
}
2093+
20842094
func (v *Viper) getConfigType() string {
20852095
if v.configType != "" {
20862096
return v.configType

0 commit comments

Comments
 (0)