Elektra serves as a universal and secure framework to access configuration parameters in a global, hierarchical key database.
Elektra provides a mature, consistent and easily comprehensible API. Its modularity effectively avoids code duplication across applications and tools regarding configuration tasks. Elektra abstracts from cross-platform-related issues and allows applications to be aware of other applications' configurations, leveraging easy application integration.
Often used links
Elektra consists of three parts:
- LibElektra is a modular configuration access toolkit to
construct and integrate applications into a global,
hierarchical key database. The building blocks are:
- language bindings (inclusive high-level interfaces)
- GenElektra, the code generator for type-safe bindings
- plugins for configuration access behaviour and validation
- SpecElektra is a configuration specification language that is easy to use and self-contained in the same key database (i.e. written in any of the configuration file formats Elektra supports).
- Tools on top of LibElektra for administrators, such as CLI tools and GUIs.
To highlight a few concrete things about Elektra, configuration data can come from any
data source, but usually comes from configuration files that are mounted into Elektra
similar to mounting a file system. As Elektra is a plugin based framework, there are a
lot of storage plugins that support various configuration formats like ini, json, xml,
etc. However, there's a lot more to discover like executing scripts (
shell) when a configuration value changes, or, enhanced validation plugins that won't
allow corrupted configuration to reach your application.
As an application developer you get instant access to various configuration formats and the ability
to fallback to a default configuration without having to deal with this on your own. As an administrator
you can choose your favourite configuration format and mount this configuration for the application.
This features easy application integration as any application using Elektra can access any mounted
configuration. You can even mount
/etc files such as
fstab, so that there is no need to
configure the same data twice in different files.
In case you're worried about linking to such a powerful library. The core is a small library implemented in C, works cross-platform, and does not need any external dependencies. There are bindings for other languages in case C is too low-level for you.
If you want to use Elektra for your application, read the application integration tutorial.
The preferred way to install Elektra is by using packages provided for your distribution. On Debian/Ubuntu, this can be done by running the following command:
sudo apt-get install elektra-bin libelektra-dev
This will install the Elektra tools as well as everything needed to develop with Elektra.
It is preferable to use a recent version: They contain many bug fixes and additional features. See INSTALL for other ways to install Elektra.
Here a small demo:
To get an idea of Elektra, you can take a look at the presentation.
The full documentation, including:
is available in the GitHub repository.
You can read the documentation for the kdb tool, either
- Make it trivial for applications and administrators to access any configuration
- Postpone some decisions from programmers to
- Make configuration storage more safe: avoid that applications receive wrong or unexpected values that could lead to undefined behaviour.
- Allow software to be better integrated on configuration level maintainers/administrators, e.g. which syntax and the location of configuration files.
- Reduce rank growth of configuration parsers in our ecosystem, but foster well maintained plugins instead.
And in terms of quality, we want:
- Simplicity (make configuration tasks simple),
- Robustness (no undefined behaviour of applications), and
- Extensibility (gain control over configuration access)
Facts and Features
- Elektra uses the BSD licence.
- Elektra implements an API to fully access a global key database.
- Elektra can be thought of a virtual file system for configuration.
- Elektra supports mounting of existing configuration files into the global key database.
- Elektra has dozens of Plugins that make it possible
to have a tiny core, but still support many features, including:
- Elektra can import and export configuration files in any supported format.
- Elektra is able to log and notify other software on any configuration changes, e.g., using Dbus and Journald.
- Elektra can improve robustness by rejecting invalid configuration via type checking, regex and more.
- Elektra provides different mechanisms to locate configuration files.
- Elektra supports different ways to escape and encode content of configuration files.
- Elektra is multi-process safe and can be used in multi-threaded programs.
- Elektra (except for some plugins) is portable and completely written in Ansi-C99.
- Elektra (except for some plugins) has no external dependency.
- Elektra is suitable for embedded systems and early boot stage programs.
- Elektra uses simple key/value pairs that include metadata for any other information.
- Elektra provides many powerful Bindings to avoid low-level access code.
- Elektra provides powerful Code Generation Techniques for high-level configuration access.
The preferred way to install Elektra is by using packages provided for your distribution, see INSTALL for available packages.
For macOS there is a homebrew tap available:
If there are no packages available for your distribution see the installation document.
Elektra uses a git repository at GitHub.
You can clone the latest version of Elektra by running:
git clone https://github.com/ElektraInitiative/libelektra.git
Releases can be downloaded from http and
After downloading or cloning Elektra,
cd to the directory and run the
following commands to compile it:
ccmake ..(optional, provides a console based GUI to give an overview of the available compilation options and settings)
Then you can use
sudo make install to install it.
For more information, especially how to set CMake Cache, see here. Make sure to read how to add plugins, tools and bindings.
To start development, just clone the repo and start hacking! We prepared beginner friendly tasks for you.