# The config system in librnd

## Scalars

Scalar settings have only one value after the merge. The only policy available is overwrite - this policy is applied regardless of the current policy setting.

## examples

### simple overwrite

Config sources:

role | priority | policy | content
--- | --- | --- | ---
system | 200 | overwrite | A
user | 400 | overwrite | (not defined)
project | 600 | overwrite | Q

Merge iterations:

step | description | output list after executing this step | remarks
--- | --- | --- | ---
0. | reset the output | (empty) |
1. | apply system | A |
2. | apply user | A | "not defined" doesn't mean "empty", so the list is not deleted - no change
3. | apply project | Q | replace the original output because of the overwrite policy

Example scenario: system default overridden by a project setting.

### user-forced value

Config sources append:

role | priority | policy | content
--- | --- | --- | ---
system | 200 | overwrite | A
user | 650 | overwrite | E
project | 600 | overwrite | Q

Merge iterations:

step | description | output list after executing this step | remarks
--- | --- | --- | ---
0. | reset the output | (empty) |
1. | apply system | A |
2. | apply project | Q |
3. | apply user | E |

Example scenario: user preference enforced: even if the project file would use 'Q' for the given setting, the user prefers 'E'. This affects runtime (the value of the setting after the merge, in other words how the application works), but does not change the project configuration. This allows the given user to always use 'E' for the given setting while lets other users working on the same project use the value set in the project file.