diff --git a/go.mod b/go.mod index 1a485b31b..a5bf661bb 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/smartystreets/goconvey v1.6.4 // indirect golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9 // indirect - gopkg.in/ini.v1 v1.56.0 + gopkg.in/ini.v1 v1.60.0 ) replace github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 diff --git a/go.sum b/go.sum index 94e123817..c5ed2d92f 100644 --- a/go.sum +++ b/go.sum @@ -93,5 +93,7 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/ini.v1 v1.56.0 h1:DPMeDvGTM54DXbPkVIZsp19fp/I2K7zwA/itHYHKo8Y= gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.60.0 h1:P5ZzC7RJO04094NJYlEnBdFK2wwmnCAy/+7sAzvWs60= +gopkg.in/ini.v1 v1.60.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vault/config.go b/vault/config.go index f0cc69f9e..40321af1b 100644 --- a/vault/config.go +++ b/vault/config.go @@ -3,11 +3,9 @@ package vault import ( "errors" "fmt" - "io/ioutil" "log" "os" "path/filepath" - "regexp" "strings" "time" @@ -113,22 +111,14 @@ func LoadConfigFromEnv() (*ConfigFile, error) { return LoadConfig(file) } -var iniKeysRegex = regexp.MustCompile(`\n[^\[\=]+\=`) - func (c *ConfigFile) parseFile() error { log.Printf("Parsing config file %s", c.Path) - src, err := ioutil.ReadFile(c.Path) - if err != nil { - return fmt.Errorf("Error parsing config file %s: %w", c.Path, err) - } - iniWithLowerCaseKeys := iniKeysRegex.ReplaceAllFunc(src, func(w []byte) []byte { - return []byte(strings.ToLower(string(w))) - }) - f, err := ini.LoadSources(ini.LoadOptions{ - AllowNestedValues: true, - }, iniWithLowerCaseKeys) + AllowNestedValues: true, + InsensitiveSections: false, + InsensitiveKeys: true, + }, c.Path) if err != nil { return fmt.Errorf("Error parsing config file %s: %w", c.Path, err) }