### 3.3 Overview of the new configuration system ¶

> Important: In definitions of location and naming of configuration files as well as their format we were guided by the two following standards:

> - XDG Base Directory Specification, and
> - Desktop Entry Specification.

Configuration parameters are always evaluated within a configuration context which defines what configuration files are processed and the processing order. Each context is associated with a configuration file (although the file does not necessarily need to exist).

There are five configuration contexts:

‘`DEFAULT`’
  - contains default values for configuration settings (read-only)
  - configuration file: none
  - parent context: none
‘`SYSTEM`’
  - contains system-wide settings
  - configuration file: `lepton-system.conf` (Since 1.9.10. Formerly it was named `geda-system.conf`.)
  - configuration file location: `$PREFIX/share/lepton-eda/` (`$PREFIX` is the installation prefix, e.g. `/usr` or `/usr/local`)
  - parent context: ‘`DEFAULT`’
  - `lepton-cli config` option to access this context: `--system` (`-s`)
‘`USER`’
  - contains per-user settings
  - configuration file: `lepton-user.conf` (Since 1.9.10. Formerly it was named `geda-user.conf`.)
  - configuration file location: `$XDG_CONFIG_HOME/lepton-eda/` (usually, `~/.config/lepton-eda/`)
  - parent context: ‘`SYSTEM`’
  - `lepton-cli config` option to access this context: `--user` (`-u`)
‘`PATH`’
  - contains per-project (per-directory) settings
  - configuration file: `lepton.conf` (Since 1.9.10. Formerly it was named `geda.conf`.)
  - configuration file location: current directory (or directory specified by `--project`)
  - parent context: ‘`USER`’
  - `lepton-cli config` option to access this context: `--project[=path]` (`-p`)
‘`CACHE`’
  - contains program-specific settings (dialog geometry, command history, etc.); normally, you do not use it directly
  - configuration file: `gui.conf`
  - configuration file location: `$XDG_CACHE_HOME/lepton-eda/` (usually, `~/.cache/lepton-eda/`)
  - parent context: none
  - `lepton-cli config` option to access this context: `--cache` (`-c`)

Context inheritance means that if particular configuration parameter is not found in some context, the value from its parent context is used instead. And if parameter is set in the child context it will override one set in the parent context(s).

Configuration file contains ‘`groups`’ and ‘`key=value`’ pairs, for example:

    [group]
    key=value

Any value can be of one of the following types:

‘`string`’
‘`boolean`’
‘`integer`’
‘`double`’
‘`list`’

Values in lists are separated with semicolons (`;`).

> Important: List values must have exactly the number of elements specified below in the manual for corresponding configuration keys. Wrong number of elements will be considered an error.

> Important: Always use point (`.`) as separator for floating point numbers if you edit a configuration file manually.

Lines beginning with a ‘`#`’ and blank lines are considered comments:

    # This is a comment

`lepton-cli` utility with the `config` command is used to read and write configuration settings:

    lepton-cli config [option] [group key [value]]

option can be either `--system`, `--user`, `--project[=path]`, or `--cache` to access the ‘`SYSTEM`’, ‘`USER`’, ‘`PATH`’, or ‘`CACHE`’ context, respectively.

For example, to get value of the `font` key from the `schematic.gui` group in the ‘`USER`’ configuration context, issue the following command, which will print the result to standard output:

    lepton-cli config --user "schematic.gui" "font"
    -| OpenGost Type B TT Regular

To set that value to ‘`Monospace Regular`’ for configuration in the current directory, type:

    lepton-cli config --project "schematic.gui" "font" "Monospace Regular"