Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Generation int
Generation is flags' generation number.
It is modified on each flags' modification via either -configUpdateInterval or SIGHUP.
Functions ¶
func OnFlagChange ¶
func OnFlagChange(flagName string, callback FlagChangeCallback)
OnFlagChange registers the callback, which is called after the given flag value is initialized and/or changed.
Flag values are initialized during iniflags.Parse() call. Flag value can be changed on config re-read after obtaining SIGHUP signal or if periodic config re-read is enabled with -configUpdateInterval flag.
Note that flags set via command-line cannot be overriden via config file modifications.
func Parse ¶
func Parse()
Parse obtains flag values from config file set via -config.
It obtains flag values from command line like flag.Parse(), then overrides them by values parsed from config file set via -config.
Path to config file can also be set via SetConfigFile() before Parse() call.
func SetConfigFile ¶
func SetConfigFile(path string)
SetConfigFile sets path to config file.
Call this function before Parse() if you need default path to config file when -config command-line flag is not set.
Types ¶
type FlagChangeCallback ¶
type FlagChangeCallback func()
FlagChangeCallback is called when the given flag is changed.
The callback may be registered for any flag via OnFlagChange().