In thinking about configuration options for Ganglia, I got to thinking
about how some of the other "web applications" out there handle
configuration, and if we can learn/borrow/steal anything from them.
As I run several MediaWiki installations at work, this was one of the
programs that came to mind.

The Mediawiki configuration has, essentially, two layers:  one for
vendor defaults as chosen and set by the developers, and one for local
settings as determined by the admins actually doing the installation.
Typically, local settings are for things like local domain names,
themes, local file paths, and other things that necessarily must vary
from site to site.  The default settings should be reasonable and sane
for what is considered to be the *common case* (if a single setting is
needed for all users, then there's little point in making it
configurable in the first place, no?).

Ganglia has something similar:  there are lots of different options
set in conf.php, many of which rarely change (graph colors, for
example), and some which basically require local configuration in
order to run at all ($gmetad_root, for example).  However, the ability
to override any default setting should be possible, if the user so
desires.

I suggest that we move the infrequently change variables out of
conf.php, and into a different file completely, named something like
"config-default.php" (the specific name doesn't matter, so long as its
purpose is obvious).   The end-users should have no need, and little
reason to change the config-default.php file, but every reason and
opportunity to change the existing conf.php file.  Both files should
have ample comments, and possible suggestions for alternate
configurations.

Actually implementing this should  be fairly easy, in theory.  Off the
top of my head, the following would need to be done:

1)  A new config file (called config-defaults.php, or something
similar) needs to be created.
2)  All current configuration settings, with default values, should be
moved to this file.  The conf.php file should have very little
"active" code, but lots of comments and helpful suggestions for things
the admin may want to change to customize their installation.
3)  In all files that currently include conf.php (apparently graph.php
and index.php) should make use of both config-default.php and
conf.php.

Step #3 could be done in (at least) two different ways:

1)  At the end of config-default.php, automatically include conf.php.
This would involve the fewest changes to other files, and is
"simpler."
2)  In the two files that currently include conf.php, add an include
for config-default.php just before the include of conf.php.  This is a
tad bit more complex, but allows for the option to *not* honor the
local changes if that is needed for some reason.  I can't think of a
specific reason we'd want to do this, other than some very vague and
flimsy hand-waving in the name of security.

I suspect that the amount of code required to do this would be shorter
than this email. :-)

Thoughts?  Comments?

-- 
Jesse Becker
GPG Fingerprint -- BD00 7AA4 4483 AFCC 82D0 2720 0083 0931 9A2B 06A2

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ganglia-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to