in reply to Configuration file design

One thing I dont get about this is why you need the "ftp_instances" key at all. I'd just have a bit of code that assumed that all Ini file sections whose name matches /^ftp/ are valid instances. Its easy enough to loop through the sections as needed, and it means that when somebody decides to delete one of the sections they dont have to remember to update the instances list, and it also means that if the users want to give the instances more descriptive names they can.

Also, an alternative for things like this is to use a DB for the config data. Of course that still leave the problem of where to put the DB connection details but allowing the user to manage their config through a web client or litte-gui may tickle their fancy more than using a config file.

---
demerphq

Replies are listed 'Best First'.
Re^2: Configuration file design
by castaway (Parson) on Jan 05, 2005 at 07:59 UTC
    Basically, I was stuck in 'I need to do X' mode, and didnt realise until I started reading my answers, that of course I can just construct that value, and not make people enter it at all.

    To confuse things some, this variable (and its associated config files), changed name between two program versions (now it does ftp or scp, and is called transfer)..

    A DB plus a GUI would be lovely, but as I said, this is a script to install a piece of software, on various machines (remote ones, usually), so actually having the DB accessable, even an SQLite one, isn't all that practicable.

    . o O(Although a nice little side project would be to extract this information from our Lotus Notes delivery DB, and precreate some of the config file, or have a CGI to create it in a DB, and a button to create the config file from that info, in which case it could well be XML or whatever.. ) O o ... I can dream..

    C.