Skip to content

Commit

Permalink
Added env options example to README file
Browse files Browse the repository at this point in the history
  • Loading branch information
karantin2020 committed Jul 6, 2019
1 parent 49e74a3 commit 4f002f3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Confita is a library that loads configuration from multiple backends and stores
## Install

```sh
go get -u github.com/heetch/confita
go get -u github.com/karantin2020/confita
```

## Usage
Expand Down Expand Up @@ -95,7 +95,10 @@ A loader can take other configured backends as parameters.

```go
loader := confita.NewLoader(
env.NewBackend(),
env.NewBackend(
env.WithPrefix("PREFIX"),
env.ToUpper(),
),
file.NewBackend("/path/to/config.json"),
file.NewBackend("/path/to/config.yaml"),
flags.NewBackend(),
Expand Down Expand Up @@ -124,7 +127,6 @@ err := loader.Load(ctx, &cfg)
If a key is not found, Confita won't change the respective struct field. With that in mind, default values can simply be implemented by filling the structure before passing it to Confita.

```go

type Config struct {
Host string `config:"host"`
Port uint32 `config:"port"`
Expand Down

0 comments on commit 4f002f3

Please sign in to comment.