Load config from /usr/share aswell

This commit is contained in:
fossdd 2024-09-04 18:41:15 +00:00 committed by Johannes Marbach
parent d82dd9051c
commit 482b23bfea
11 changed files with 28 additions and 9 deletions

View file

@ -44,6 +44,8 @@ Mandatory arguments to long options are mandatory for short options too.
-C, --config-override Path to a config override file. Can be supplied
multiple times. Config files are merged in the
following order:
* /usr/share/buffyboard.conf
* /usr/share/buffyboard.conf.d/* (alphabetically)
* /etc/buffyboard.conf
* /etc/buffyboard.conf.d/* (alphabetically)
* Override files (in supplied order)

View file

@ -57,6 +57,8 @@ static void print_usage() {
" -C, --config-override Path to a config override file. Can be supplied\n"
" multiple times. Config files are merged in the\n"
" following order:\n"
" * /usr/share/buffyboard.conf\n"
" * /usr/share/buffyboard.conf.d/* (alphabetically)\n"
" * /etc/buffyboard.conf\n"
" * /etc/buffyboard.conf.d/* (alphabetically)\n"
" * Override files (in supplied order)\n"

View file

@ -27,6 +27,8 @@ result.
*-C, --config-override*
Path to a config override file. Can be supplied multiple times. Config
files are merged in the following order:
- /usr/share/buffyboard.conf
- /usr/share/buffyboard.conf.d/\* (alphabetically)
- /etc/buffyboard.conf
- /etc/buffyboard.conf.d/\* (alphabetically)
- Override files (in supplied order)

View file

@ -14,10 +14,11 @@ one option/value pair per line:
<option>=<value>
```
The default configuration file is at /etc/buffyboard.conf, BUFFYBOARD will use this
configuration file if present along with overrides placed in
/etc/buffyboard.conf.d/ and those specified with the -C option. All config files
will be merged in the following order:
On launch, BUFFYBOARD searches for configuration files in various locations and
successively merges all files together into a single configuration. Files are searched
for and, if found, merged in the following order:
- /usr/share/buffyboard.conf
- /usr/share/buffyboard.conf.d/ (alphabetically)
- /etc/buffyboard.conf
- /etc/buffyboard.conf.d/ (alphabetically)
- Override files (in supplied order)

View file

@ -188,6 +188,8 @@ int main(int argc, char *argv[]) {
/* Parse config files */
bb_config_init_opts(&conf_opts);
bb_config_parse_file("/usr/share/buffyboard.conf", &conf_opts);
bb_config_parse_directory("/usr/share/buffyboard.conf.d", &conf_opts);
bb_config_parse_file("/etc/buffyboard.conf", &conf_opts);
bb_config_parse_directory("/etc/buffyboard.conf.d", &conf_opts);
bb_config_parse_files(cli_opts.config_files, cli_opts.num_config_files, &conf_opts);