Reorganize configuration variables, now all settings can be customized from initrc.local and the default initrc documents the available options

This commit is contained in:
Uriel 2008-09-17 02:16:33 +02:00
parent 88cae6e429
commit ca3c688c52
2 changed files with 49 additions and 20 deletions

View file

@ -1,24 +1,6 @@
#!/usr/local/plan9/bin/rc
path=(. ./bin $PLAN9/bin /bin/ /usr/bin)
uri = `{echo -n $REQUEST_URI | sed -e 's/\?.*//; s/[^a-zA-Z0-9_+\-\/\.]//g; s/\.\.*/./g;' -e '1q'}
ifs='/' {
args = `{echo -n $uri}
}
cd ..
# default config
formatter=markdown.pl
formatter=md_cache # markdown cacher
site=$SERVER_NAME
sitedir=sites/$site
headers=inc/headers.tpl
template=_default
sidebar=sidebar
baseuri=http://$site/
for(i in siteTitle siteSubTitle title extraHeaders)
$i = ''
# Useful functions
fn dprint {
@ -242,13 +224,35 @@ dprint $body
}
fn genbody {
# Actually execute request
$handler $handler_args
}
# Careful, the proper p9p path might not be set until initrc.local is sourced
path=(. $PLAN9/bin ./bin/ /bin/ /usr/bin)
site=$SERVER_NAME
headers=inc/headers.tpl
template=_default
sidebar=sidebar
baseuri=http://$site/
for(i in siteTitle siteSubTitle title extraHeaders)
$i = ''
. etc/initrc
if(test -f etc/initrc.local)
. etc/initrc.local
# Parse request URL
uri = `{echo -n $REQUEST_URI | sed -e 's/\?.*//; s/[^a-zA-Z0-9_+\-\/\.]//g; s/\.\.*/./g;' -e '1q'}
ifs='/' {
args = `{echo -n $uri}
}
if(! ~ $#debug 0)
dprint ' ' $SERVER_NAME^$REQUEST_URI^' - '^$"HTTP_USER_AGENT