A proposal for Redox configuration system
Created by: tennix
Traditional *nix system has config files everywhere and in different formats. That's a headache for users. For simplicity I think Redox should have a central place to store configs and in a transparent format, that is it should be easy for users to find their configs and read/write easily without special tools.
Due to everything is a URL in Redox, and inspired by Etcd. I think Redox can have following URLs to config the whole system.
system config config://pkg-name/version/system/key/value
user config config://pkg-name/version/username/key/value
for example git config should be organized as following:
config://git/2.3.8/system/core.editor/vim
config://git/2.3.8/tennix/core.editor/emacs
That way it's easy to read and set a configuration item. For example if we serve configs as http resource, we can use curl to get and set an item just like in etcd.
But the problem is that we can no longer comment our configurations for documentation purpose.
For this we have two solutions:
- make doc as a key in configuration
config://pkg-name/version/system/doc/index.html
config://pkg-name/version/username/doc/index.html
- make doc as a new scheme
doc://pkg-name/version/system/index.html
doc://pkg-name/version/username/index.html
Either way docs are normal text files but rendered as html for better read. Redox can provide some basic converters to convert common markup doc like rst/md to html, and users can provide their own doc converters if needed.
Since everything is URL, we can easily get all configurations and render them in a webpage. And what's more, we can even config our system in a web browser just like Firefox's about://config and Chrome's chrome://settings
For compatibility with current *nix software, we can map these urls to their current file config. Or just specify the config file path as a key in the url like config://git/2.3.8/tennix/configpath//home/tennix/.gitconfig
Of course the file path /home/tennix/.gitconfig
should be encoded as safe url here, but that's not the main point here.
Besides with proper permissions, we can share our configuration to others. And if we want, we can even import other systems' configuration in the same network. Just like mount a remote filesystem to local machine, we "mount" remote system's settings as local settings.
Some problems:
- How to sync comment with config?
- A proper permission model
- ...