Make coding easier – combine configuration from multiple sources

The main problem which this library solves is a plain old boilerplate code which is common when we talk about configuration parsing.

This library is developed as a part of the spark-sql-bootstrap.core and kafka-streaming-bootstrap.core libraries and is later extracted into a separate project. The reason for that is it could be used when developing any application or program besides these.

The library key features are:

– Creating self-documented and easy-to-use command-line interface

– Parsing configurations from command line arguments

– Parsing configurations from a file of different formats

– Performing string interpolation of environment variables using placeholders

There are three main APIs:

1. ICommandLine – used for creating a CLI and parsing configuration from command line arguments. By default, configuration-utils use DefaultCliAdapter as an implementation of the ICommandLine interface. The DefaultCliAdapter is based on the widely used Commons CLI library.

2. IParser – used for parsing configuration from files of arbitrary format. The default implementation of the IParser interface is JsonConfigurationParser which relies on the Jackson serialization library.

3. IStringInterpolator – used for interpolating environment variables in the key-value format into the raw configuration files. The default interpolation algorithm is based on variables surrounded by the key prefixes and suffixes. Also, some variable(s) can have a default value which is considered if the environment variable hasn’t been set.

There is also a utility API called ConfigurationContext which acts as a unified API (facade) that reads from the configuration files, interpolates the environment variables and overrides fields with command line arguments.

DOWNLOAD LIBRARY ON GITLAB

Ready to transform your enterprise with Qubinets?