diff --git a/secondly.go b/secondly.go index d552ace..5d6fcd7 100644 --- a/secondly.go +++ b/secondly.go @@ -21,6 +21,7 @@ var ( configFile string callbacks = make(map[string][]func(oldVal, newVal interface{})) initialized bool + initFunc func() ) // SetupFlags sets up Confection configuration flags. @@ -96,6 +97,12 @@ func HandleFSEvents() { }() } +// OnLoad sets up a callback function that would be called once configuration +// is loaded for the first time. +func OnLoad(fun func()) { + initFunc = fun +} + // OnChange adds a callback function that is triggered every time a value of // a field changes. func OnChange(field string, fun func(oldVal, newVal interface{})) {