# README
flagcfg
The flagcfg package populates flags from a TOML config file. Each flag is assumed to have an optional top-level value in the config file, having the same name. However, if a flag contains a dash or a period, those are converted to underscores.
Flags that have aready been assigned are not overwritten.
This package can be used together with github.com/facebookgo/flagenv to load flags from a config file, environment variable, or command-line.
Example:
// Parse flags from command-line
flag.Parse()
// Parser flags from config
flagcfg.AddDefaults()
// or use flagcfg.AddDefaultFiles("MYAPP_CONFIG", "myapp.config")
flagcfg.Parse()
// Parse flags from environment (using github.com/facebookgo/flagenv)
flagenv.Prefix = "MYPREFIX_"
flagenv.Parse()
# Functions
AddDefaultFiles adds default config file locations to search, using the given environment variable name and name of the config file to look for (excluding path).
AddDefaults adds default config file locations, using the binary name as a base.
AddFile adds a location to search for a config file.
Filename returns the name of the config file that was parsed by Parse().
FindConfig returns the first config file that exists in the list.
Parse will set each defined flag from the first configuration file found in the list of those added.
ParseSet parses the configuration data in TOML format, placing found values into the flag set.