From: <Cra...@nt...> - 2005-02-19 09:01:20
|
Author: CrawfordCurrie Date: 2005-02-19 00:59:02 -0800 (Sat, 19 Feb 2005) New Revision: 3651 Modified: twiki/branches/DEVELOP/lib/LocalSite.cfg.txt twiki/branches/DEVELOP/lib/TWiki.cfg twiki/branches/DEVELOP/lib/TWiki.pm Log: TWikiDotCfgNeedsGardening: on TWikiIRC 19-feb-05 is discussion leading to this change. Basically it now reads LocalSite.cfg twice, so that defaults are easier to set up. Still works with TWiki.cfg alone, but not recommended. Modified: twiki/branches/DEVELOP/lib/LocalSite.cfg.txt =================================================================== --- twiki/branches/DEVELOP/lib/LocalSite.cfg.txt 2005-02-19 03:39:37 UTC (rev 3650) +++ twiki/branches/DEVELOP/lib/LocalSite.cfg.txt 2005-02-19 08:59:02 UTC (rev 3651) @@ -19,6 +19,9 @@ # you may think it does). You can use '\' without problems inside # single quotes, e.g. 'c:\foo'. +# If LocalSite.cfg is used (and it _should_ be), then _all_ the +# following paths muct be defined. + # URL for TWiki host e.g. http://myhost.com:123 $cfg{DefaultUrlHost} = 'http://your.domain.com'; @@ -36,6 +39,12 @@ $cfg{TemplateDir} = '/home/httpd/twiki/templates'; # Topic files store (file path not URL) e.g. /usr/local/twiki/data +# TWiki will use this path to base other defaults, such as the location +# of password files. $cfg{DataDir} = '/home/httpd/twiki/data'; +# TWiki.cfg will use this path to default where to put log files, unless +# you override individual paths here. +$cfg{LogDir} = $cfg{DataDir}; + 1; Modified: twiki/branches/DEVELOP/lib/TWiki.cfg =================================================================== --- twiki/branches/DEVELOP/lib/TWiki.cfg 2005-02-19 03:39:37 UTC (rev 3650) +++ twiki/branches/DEVELOP/lib/TWiki.cfg 2005-02-19 08:59:02 UTC (rev 3651) @@ -46,29 +46,25 @@ # normally be written as "c:/foo" not "c:\foo" (which doesn't do what # you may think it does). You can use '\' without problems inside # single quotes, e.g. 'c:\foo'. - +# +# These paths _must_ be set in LocalSite.cfg +# # URL for TWiki host e.g. http://myhost.com:123 -$cfg{DefaultUrlHost} = 'http://your.domain.com'; - +# $cfg{DefaultUrlHost} = 'http://your.domain.com'; # cgi-bin URL path for TWiki e.g. /twiki/bin -$cfg{ScriptUrlPath} = '/twiki/bin'; - +# $cfg{ScriptUrlPath} = '/twiki/bin'; # Attachments URL path e.g. /twiki/pub -$cfg{PubUrlPath} = '/twiki/pub'; - +# $cfg{PubUrlPath} = '/twiki/pub'; # Attachments store file path (not URL), must match /twiki/pub e.g. # /usr/local/twiki/pub -$cfg{PubDir} = '/home/httpd/twiki/pub'; - +# $cfg{PubDir} = '/home/httpd/twiki/pub'; # Template directory e.g. /usr/local/twiki/templates -$cfg{TemplateDir} = '/home/httpd/twiki/templates'; - +# $cfg{TemplateDir} = '/home/httpd/twiki/templates'; # Topic files store (file path not URL) e.g. /usr/local/twiki/data -$cfg{DataDir} = '/home/httpd/twiki/data'; - +# $cfg{DataDir} = '/home/httpd/twiki/data'; # URL path to scripts used to render links. Defaults to the same as # $cfg{ScriptUrlPath}. Set if using redirection to shorten URLs. -$cfg{DispScriptUrlPath} = undef; +# $cfg{DispScriptUrlPath} = undef; # Suffix of TWiki Perl scripts (e.g. .pl) $cfg{ScriptSuffix} = ''; @@ -192,18 +188,16 @@ # Name of the various log files. You can use %DATE% in the pathnames # to make the file renewed every month e.g. /var/log/TWiki/log.%DATE%. -# Directory must be writable by the CGI user (Note: this variable is -# local to this file; it is not used in the code). -my $logDir = $cfg{DataDir}; +# $cfg{LogDir} directory must be writable by the CGI user # File for debug messages (usually very low volume) -$cfg{DebugFileName} = "$logDir/debug.txt"; +$cfg{DebugFileName} = "$cfg{LogDir}/debug.txt"; # Warnings - low volume, hopefully! -$cfg{WarningFileName} = "$logDir/warn%DATE%.txt"; +$cfg{WarningFileName} = "$cfg{LogDir}/warn%DATE%.txt"; # Access log - high volume, depending on what you enabled in $cfg{Log} -$cfg{LogFileName} = "$logDir/log%DATE%.txt"; +$cfg{LogFileName} = "$cfg{LogDir}/log%DATE%.txt"; ######## External programs ########################################### # NOTE: You might want to avoid c: at start of cygwin unix commands on Modified: twiki/branches/DEVELOP/lib/TWiki.pm =================================================================== --- twiki/branches/DEVELOP/lib/TWiki.pm 2005-02-19 03:39:37 UTC (rev 3650) +++ twiki/branches/DEVELOP/lib/TWiki.pm 2005-02-19 08:59:02 UTC (rev 3651) @@ -132,9 +132,18 @@ $TWiki::cfg{OS} = 'OS2'; } + do "LocalSite.cfg"; + die "Bad configuration: $@" if $@; + + foreach my $var ( "DataDir", "DefaultUrlHost", "PubUrlPath", "PubDir", "TemplateDir" ) { + die "$var must be defined in LocalSite.cfg" + unless( defined $TWiki::cfg{$var} ); + } + do "TWiki.cfg"; die "Cannot read TWiki.cfg: $!" if $!; die "Bad configuration: $@" if $@; + do "LocalSite.cfg"; die "Bad configuration: $@" if $@; |