Subject: Proposal for a user config system
To: None <tech-userlevel@netbsd.org>
From: Heiko W.Rupp <hwr@pilhuhn.de>
List: tech-userlevel
Date: 10/24/1998 21:37:27
Hi,

below you will find a proposal for a user config system where 
preferences etc. are no longer saved in environement variables
and which provides for some sort of 'fallback' to system wide defaults.
Those who ever saw a NeXT will be probably remnded of the dread/dwrite
system
There has no code been written jet - this is a RfD at the moment, so 
please comment on it.
 
  Heiko



Uconfig
-------

Uconfig, tools and a library to set and query user preferencs and
config values etc.

User defaults are most often set in environment variables under Unix.
In other cases many tools have config files to set some of their 
operating parameters. This results in may different flavours of config
files and much code duplication.

The idea behind Uconfig is a four (or even six )level approach in 
setting/getting config data:

1) User specific, Tool specific config info
2) User specific, generic config info
3) Host specific, Tool specific config info
4) Host specific, generic config info
5) Site specific, Tool specific config info
6) Site specific, generic config info

while 1-4 are only local to one host, 5 and 6 query a central server to
set/get the desired data.

An Example "ftp" wants to use a proxy for http :

1) lookup data for user/ftp/http_proxy.
2) lookup data for user/GLOBAL/http_proxy.
3) lookup data for site/ftp/http_proxy.
4) lookup data for site/GLOBAL/http_proxy.

After the first match the data found is returned to the caller.
This has the advangate, that the site administrator can easily set 
defaults for applications that the user can also as easy override.
Also there is no need to set the same config data in various places (e.g.
sh vs csh startup files).

Users can set query data with a tool like

# get config data for user/ftp/http_proxy
$ uconfig  ftp http_proxy
http://www.pilhuhn.de:3128/

# get config data for user/GLOBAL/http_proxy
$ uconfig GLOBAL http_proxy
http://master.proxy.org:3128/

# delelete the specific data for usr/ftp/http_proxy
$ uconfig -d ftp http_proxy
$ uconfig  ftp http_proxy
http://master.proxy.org:3128/

# set a value for usr/GLOBAL/http_proxy
$ uconfig -w GLOBAL http_proxy http://some.site.org:3128/

The admin can also set/reset values for users 
# uconfig -u joeluser -s ftp http_proxy

Applications can set/query the data with the appropriate library
functions (uconfig is merly a warpper around those).

All data is saved in two db files ~/.uconfig and /etc/uconfig for faster 
access. The uconfig tool will allow to convert from ascii text to db and 
vice versa.