Skip to content

reox/libelektra

 
 

Repository files navigation

Elektra

Elektra serves as a universal and secure framework to access configuration settings in a global, hierarchical key database.

Elektra

Elektra provides a mature, consistent and easily comprehensible API. Its modularity effectively avoids code duplication across applications and tools concerning their configuration tasks. Elektra abstracts from cross-platform-related issues and enables applications to be aware of other applications' configurations, leveraging easy application integration.

Often used links

Overview

Elektra consists of three parts:

  1. 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
  2. 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).
  3. Tools on top of LibElektra for system administrators, such as CLI tools, web UIs, and GUIs.

To highlight a few concrete things about Elektra, configuration settings can come from any data source, but usually comes from configuration files that are mounted into Elektra similar to mounting a file system. Elektra is a plugin-based framework, for example, plugins implement various configuration formats like INI, JSON, XML, etc. There is a lot more to discover like executing scripts (python, lua or shell) when a configuration value changes, or, enhanced validation plugins that will not allow corrupted configuration settings to reach your application.

As an application developer you get instant access to various configuration formats and the ability to fallback to default configuration settings without having to deal with this on your own. As an system administrator you can choose your favourite configuration format and mount this configuration for the application. Mounting enables easy application integration as any application using Elektra can access any mounted configuration. You can even mount /etc files such as hosts or fstab, so that there is no need to configure the same values twice in different files.

In case you are 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.

Contact

Do not hesitate to ask any question on GitHub issue tracker, Mailing List or directly to one of the authors.

Quickstart

If you want to use Elektra for your application, read the application integration tutorial.

Installation

The preferred way to install Elektra is by using packages provided for your distribution, see INSTALL for available packages and alternative ways for installation.

Note: It is preferable to use a recent version: They contain many bug fixes and usability improvements.

Usage

Now that we have Elektra installed, we can start using the kdb command:

asciicast

For import/export/mount formats see Plugins. For information about elektrified environment variables, see /src/libgetenv/README.md.

For people preferring graphical user interfaces, we provide qt-gui.

Documentation

To get an idea of Elektra, you can take a look at the presentation.

In the GitHub repository the full documentation is available, including:

You can read the documentation for the kdb tool, either

Note: All these ways to read the documentation provide the same content, all generated from the GitHub repository.

Goals

  • Make developers live easier by proving a well-tested mature library instead of rolling your own configuration system for every application. This reduces rank growth of configuration systems (including but not limited to configuration file parsers) in our ecosystem and fosters well-maintained plugins instead.
  • Postpone configuration decisions (such as which configuration files to use) from developers to system administrators and package maintainers to provide a overall more consistent and user-friendly system. (Default behavior of applications still is in control of developers, you can even roll your own plugins to provide exactly the same behavior as your application has now.)
  • Make configuration storage more safe: avoid that applications receive wrong or unexpected values that could lead to undefined behaviour.

And in terms of quality, we want:

  1. Simplicity (make configuration tasks, like access of configuration settings, simple),
  2. Robustness (no undefined behaviour of applications), and
  3. Extensibility (gain control over configuration access)

Read more about the goals of Elektra

Facts and Features

  • Elektra uses simple key-value pairs.
  • 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 a 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, for example, 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 provides many powerful Bindings to avoid low-level access code.
  • Elektra provides powerful Code Generation Techniques for high-level configuration access.

News

Go to the website, see News, and its RSS feed.

Download

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 ftp://ftp.libelektra.org/elektra/releases/

Build Server

The build server builds Elektra for every pull request and on every commit in various ways and also produces LCOV code coverage report.

Contributing

Take a look at how to start.

About

Elektra serves as a universal and secure framework to access configuration parameters in a global, hierarchical key database.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 42.7%
  • C++ 40.1%
  • CMake 3.5%
  • JavaScript 3.3%
  • Shell 2.7%
  • HTML 1.4%
  • Other 6.3%