Skip to content

Allow EmptyStrings to read from Environmental Variables #317

@plamenGo

Description

@plamenGo

The code below inside the find(key string) function in viper.go, makes it so that if an env var is set to "", the default value is used instead. I have a use case where I need the default to be overridden with empty string from the environment. Any chance this will get implemented in this way?

 envkey, exists := v.env[key]
  if exists {
    jww.TRACE.Println(key, "registered as env var", envkey)
    if val = v.getEnv(envkey); val != "" {
      jww.TRACE.Println(envkey, "found in environment with val:", val)
      return val

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions