Documentation
¶
Overview ¶
Package configproperties reads Java `.properties` configuration through the config codec seam.
It is a sibling of the config core, not part of it, and adds no dependency at all — a properties file is read with the standard library.
config.NewStore(ctx, config.WithFiles(fsys, "/etc/app.yaml"), // YAML, the default config.WithBackend(configproperties.New(fsys, "/etc/app.properties")), )
Keys nest on dots ¶
A properties key is dotted already, and each dot is a nesting separator, so `server.host=localhost` reads as server.host and merges into a nested YAML or JSON layer by the same path. In Java a dotted key is a single flat string; here it nests, which is what makes it a configuration layer rather than a map.
The format it honours ¶
`key=value`, `key:value` and `key value` are all separators; leading whitespace and whitespace around the separator is ignored; `#` and `!` begin a comment; a line ending in an odd number of backslashes continues onto the next; and the standard escapes are recognised in keys and values — `\t \n \r \f \\`, an escaped separator or space, and `\uXXXX`. The format is read-only, and values are strings that the read path casts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Codec ¶ added in v0.2.0
type Codec struct{}
Codec decodes key=value properties into layer values. New uses it, and it is exported so a backend adapter can reuse it as a value decoder — a key whose value is a properties document, decoded via that adapter's WithValueCodec option. It is a config.Codec.