Documentation
¶
Overview ¶
Package hcl provides the HCL configuration decoder for CONGA applications.
Register Decode with conga.App.RegisterDecoder to enable HCL configuration support:
app.RegisterDecoder(".hcl", hcl.Decode)
Key Mapping ¶
A top-level HCL attribute matches a flag's config tag as written or, when it has no tag, the flag name spelled in the app's key casing (conga.ConfigKeyCase, kebab-case by default). Other spellings and letter cases are unknown fields:
# config.hcl http-port = 8080 database-url = "postgres://localhost/db" max-retries = 5
Blocks decode as nested maps keyed by block type. A labeled block (server "web" { ... }), a repeated block type, and a block that shares its name with an attribute are rejected.
Numbers ¶
Numbers decode to int64, or to uint64 above the int64 range, or to float64 when they have a fraction. HCL keeps a number's value but not its spelling, so a whole number outside both 64-bit integer ranges is rejected whether it was written in full or with an exponent (1e30), as is a number that overflows float64.
Parse and semantic failures (undefined variables) and these rejections wrap ErrParse, and an empty document decodes to an empty map.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrParse indicates a syntax or semantic error in HCL configuration. ErrParse = errors.New("hcl parse error") )
Functions ¶
Types ¶
This section is empty.