Skip to content

Commit

Permalink
Support nested env keys with automatic env in Viper
Browse files Browse the repository at this point in the history
  • Loading branch information
sagikazarmark committed Dec 12, 2018
1 parent 101d627 commit b05e9d0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"os"
"strings"
"time"

"github.com/sagikazarmark/modern-go-application/internal/platform/database"
Expand Down Expand Up @@ -122,6 +123,7 @@ func Configure(v *viper.Viper, p *pflag.FlagSet) {
_ = v.BindPFlags(p)

v.SetEnvPrefix("app")
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_", "-", "_"))
v.AutomaticEnv()

// Global configuration
Expand Down

0 comments on commit b05e9d0

Please sign in to comment.