Table of Contents

IConfiguration Interface

A read-only view of the configuration: the whole of it, or one section.

Remarks

Paths use dots to separate levels and brackets to address an array item: Catalog.Port, Shards[0].Connection.Hostname. They are relative to this section, and an empty path means the section itself. Key lookup is not case-sensitive.

A section keeps the configuration it belongs to alive, so it remains valid for as long as it is referenced.

Syntax

Unit: Bcl.Configuration

IConfiguration = interface(IInterface);

Methods

Name Description
Bind Fills AInstance with the values of this section, and validates it.
Describe Lists the keys of this section and the source each one came from, one line per key. The values are not included.
Exists Whether the key is present. A key holding a JSON null is present.
GetBoolean Reads a boolean. ADefault is returned only when the key is absent.
GetChildren The members of an object, in the order they were first defined, or the items of an array. Empty for anything else.
GetInt64 Reads a 64-bit integer. ADefault is returned only when the key is absent.
GetInteger Reads an integer. ADefault is returned only when the key is absent.
GetSection Returns the section at APath. Never nil: for a key that is not present, Exists of the result is False.
GetString Reads a string. ADefault is returned only when the key is absent: a value that is present and is not a string is an error.
GetStrings Reads a list of strings. Returns an empty list when the key is absent.
IsArray Whether this section is an array. True as well for a value that came from an environment variable and holds a JSON array.
IsObject Whether this section is an object, with named members.
Key The last segment of Path: the member name, or the index as text for an array item. Empty for the root.
Path The full path of this section, from the root. Empty for the root.
RequireBoolean Reads a boolean that must be present.
RequireInt64 Reads a 64-bit integer that must be present.
RequireInteger Reads an integer that must be present.
RequireSection Returns the section at APath, and raises EConfiguration​Exception if the key is absent or is not an object or an array.
RequireString Reads a string that must be present and must not be empty.
RequireStrings Reads a list of strings that must be present. An empty list is accepted.