Documentation
¶
Overview ¶
Package configfile reads structured configuration files (Team, Loop, Roster, and future Workflow/Controller definitions) and decodes them into caller-supplied Go values. JSON, YAML, and TOML are supported; the format is detected from the file extension.
Non-JSON formats are normalized through a JSON intermediate so that DisallowUnknownFields semantics and json struct tags are applied uniformly across all formats. This keeps deferred or misspelled fields from silently becoming no-ops regardless of how the author chose to write the file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode decodes raw config bytes into dst. The path is used only for format detection. This is useful when the caller has already read the file (for example to apply a pre-processing step) or is working with embedded data.
func Load ¶
Load reads a config file and decodes it into dst. The format is detected from the file extension: .json (default), .yaml/.yml, or .toml. Unknown fields are rejected in all formats. For non-JSON formats the content is first decoded into a generic value and re-encoded as JSON so that the strict json.Decoder path and json struct tags apply uniformly.
Types ¶
type Format ¶
type Format int
Format identifies the encoding of a config file.
func DetectFormat ¶
DetectFormat infers the config format from the file extension. Unknown extensions default to JSON so that existing callers that pass paths without an explicit extension continue to work.