3 ms·
I'm not sure why this [1] pattern can't be adopted/extended. Put everything in a .config directory. Search path for config is: * /etc/config * $XDG_CONFIG_HO
by rswail 6y ago
I'm not sure why this [1] pattern can't be adopted/extended. Put everything in a .config directory.
Search path for config is:
* /etc/config
* $XDG_CONFIG_HOME (~/.config)
* $PROJECT_CONFIG ($PROJECT_ROOT/.config)
* directories between $PROJECT_ROOT and $CWD for .config
* $CWD/.config
This allows for system wide, then user wide, then project wide, then directory hierarchy configs, with lower levels overriding higher ones.
Inside .config, each tool can have it's own chosen file, directory, extensions directory, so:
.config/$TOOL.{json,yaml,toml,ini,xyz}
.config/$TOOL/config.ext
.config/$TOOL.d/modular config files eg 00-module.ext
Most of the time for most projects, there will be system wide and user wide config, then a project wide config. Overrides lower in the hierarchy tend to be less used.
Yes, it means that there's a tree search for a tool to get its final config. Whether that's a real issue for performance or otherwise is a potential to remove some of the hierarchy/search.
[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html https://specifications.freedesktop.org/basedir-spec/basedir-...