spf13 / viper

Go configuration with fangs
MIT License
26.89k stars 2.01k forks source link

Why can not get the value? #431

Open wpecker opened 6 years ago

wpecker commented 6 years ago
[aupost]
  accessSecret  = 'aaaaa'
  pipelineID    =  'bbbb'
viper.GetString("aupost.accessSecret")   //  Get to be empty
viper.GetString("aupost.accesssecret")   //  Get is aaaaa

From the results of the operation is case sensitive? This violates the configuration that is writeable.

I checked the code, it seems really turned into lowercase, what will be converted?

func (v *Viper) Get(key string) interface{} {
    lcaseKey := strings.ToLower(key)
    val := v.find(lcaseKey)
varshayadav commented 6 years ago

Viper is doing case insensitive operation. What is output of viper.GetString("aupost.accessSecret")?? Is this issue still exist?

wpecker commented 6 years ago

@varshayadav Which version is fixed?