Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Yiling-J/piper
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiling-J committed Nov 21, 2021
2 parents b62c499 + 3b59bc9 commit 9e57c62
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ import (
//go:embed config/*
var configFS embed.FS

piper.SetFS(configFS)
piper.Load("config/stage.toml")
author := piper.GetString(config.Author)
```
Expand All @@ -128,6 +129,8 @@ var configFS embed.FS
os.Setenv("SECRET", "qux")
// make sure turn on AutomaticEnv first then loading config,
// this way the env vaiable is also cached, so IGet* methods can work properly
piper.SetFS(configFS)
piper.Load("config/stage.toml")
piper.V().AutomaticEnv()
piper.Load("config/stage.toml")
secret := piper.GetString(config.Secret)
Expand Down Expand Up @@ -159,6 +162,7 @@ var configFS embed.FS

// "config/stage_with_secret.toml" is not in source code,
// may come from docker build or k8s ConfigMap
piper.SetFS(configFS)
piper.Load("config/stage_with_secret.toml")
author := piper.GetString(config.Author)
```
Expand Down

0 comments on commit 9e57c62

Please sign in to comment.