From 0cbd8e8ca3137a158fe2cdde50d7a0ce3a788cdd Mon Sep 17 00:00:00 2001 From: ktong Date: Sun, 12 Nov 2023 14:34:39 -0800 Subject: [PATCH] add doc --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 77c3a4d7..06a757f2 100644 --- a/README.md +++ b/README.md @@ -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 ... } ```