goconfig

This package implements a basic configuration file parser language which
provides a structure similar to what you would find on Microsoft Windows INI
files.

The configuration file consists of sections, led by a "[section]" header and
followed by "name: value" entries; "name=value" is also accepted. Note that
leading whitespace is removed from values. The optional values can contain
format strings which refer to other values in the same section, or values in a
special DEFAULT section. Additional defaults can be provided on initialization
and retrieval. Comments are indicated by ";" or "#"; a comment may begin
anywhere on a line, including on the same line after parameters or section
declarations.

For example:

[My Section]foodir:%(dir)s/whateverdir=foo

would resolve the "%(dir)s" to the value of "dir" (foo in this case). All
reference expansions are done on demand.

The functionality and workflow is loosely based on the configparser package of
the Python Standard Library.

Installation

$ goinstall github.com/kless/goconfig/config

Configuration

Nothing.

Operating instructions

Given a sample configuration file:

[DEFAULT]host:www.example.comprotocol:http://base-url:%(protocol)s%(host)s[service-1]url:%(base-url)s/some/pathdelegation:onmaxclients:200# do not set this highercomments:Thisisamulti-lineentry# And this is a comment