Skip to content

Commit

Permalink
add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ktong committed Nov 12, 2023
1 parent 894f097 commit 0cbd8e8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,18 @@ configuration source(s). They read configuration in terms of functions in packag

```
func (app *appObject) Run() {
// Read the server configuration.
type serverConfig struct {
Host string
Port int
}
cfg := konf.Get[serverConfig]("server")
// Register callbacks while server configuration changes.
konf.OnChange(func() {
// Reconfig the application object.
}, "server")
// ... use cfg in app code ...
}
```
Expand Down

0 comments on commit 0cbd8e8

Please sign in to comment.