twigkit/fig

Add support for nested configuration keys

Opened this issue · 0 comments

We extend our properties loader to handle configuration keys that encode a nested configuration path using dot notation. For example, a configuration file containing the following assignment

parent.child.property: myValue

represents the following configuration hierarchy:

parent
    child
        property: myValue

Example

Consider the following traditional hierarchy:

platforms
    fusion
        - host: localhost
        - port: 9090
        - collection: documents_collection
        people
            - collection: people_collection

The same hierarchy can be represented in a flat format as follows:

platforms.fusion.host: localhost
platforms.fusion.port: 9090
platforms.fusion.collection: documents_collection
platforms.fusion.people.collection: people_collection

This achieves the same level of brevity in configuration (using hierarchical configuration syntax) with less overhead in terms of files under management.

Combining nested keys with a file tree hierarchy

We can combine configuration files with nested keys with a traditional configuration represented by a file hierarchy.