# Config file for Brazil IM - version 3
# Session management:
#  each user has 3 sessions:
#  - "Cookie" session for all operations except:
#  - POST."cookie" for retrieving messages.  Since this normally blocks
#    waiting for a message, this needs to be in a different session than
#    normal operations.
#  - "common" session.  All clients share this for registering new
#    accounts, to prevent race conditions.  No user specific info is
#    kept with this session.
#  Information to be shared between the "Cookie" session and the
#  POST,"cookie" session must be explicitly copied between the 2 namespaces

log=3
port=5007

handler=sunlabs.brazil.server.ChainHandler
handlers= calc file poll admin register session post template

# turn on the calculator as a side effect of name lookups

calc.class=sunlabs.brazil.properties.ExprPropsHandler

# all files in the "data" directory are delivered "as is" with
# no processing

file.class=sunlabs.brazil.server.FileHandler
file.root=data
mime.au=audio/basic
mime.gif=image/gif

# poll periodically to cleanup idle sessions

poll.class=sunlabs.brazil.handler.PollHandler
poll.url=http://localhost:${port}/admin/clean.html
poll.interval=120
poll.headers=poll
poll.name=Cookie
poll.value=BrazilIM=admin;

# restrict access to admin stuff to browsers on the server host

admin.class=sunlabs.brazil.handler.RestrictClientHandler
admin.prefix=/admin
admin.allow=127.0.0.1
admin.redirect=/index.html

# use cookies to determine session state

session.class=sunlabs.brazil.handler.CookieSessionHandler
# session.persist=true
session.cookie=BrazilIM

# Modify the session for message requests, so requests waiting for
# messages don't block other requests from the same session

post.class=sunlabs.brazil.handler.SimpleSessionHandler
post.prefix=/bottom
post.value=POST.${SessionID}
post.force=true

# Process templates using a common session for registration

register.class=sunlabs.brazil.template.TemplateHandler
register.templates=digest bsl set headers form eval subst debug
register.session=register.namespace
register.prefix=/register
register.namespace=users

# Normal template processing, using either of the two user sessions

template.class=sunlabs.brazil.template.TemplateHandler
template.templates=digest bsl set queue headers form date eval subst debug

# templates and their options

bsl.class=sunlabs.brazil.template.BSLTemplate
bsl.debug=1
set.class=sunlabs.brazil.template.SetTemplate
set.query=query.
set.headers=headers.
set.saveOk=true
queue.class=sunlabs.brazil.template.QueueTemplate
headers.class=sunlabs.brazil.template.AddHeaderTemplate
form.class=sunlabs.brazil.template.FormTemplate
date.class=sunlabs.brazil.sunlabs.DateTemplate
eval.class=sunlabs.brazil.template.ScriptEvalTemplate
digest.class=sunlabs.brazil.sunlabs.DigestTemplate
subst.class=sunlabs.brazil.sunlabs.SubstAllTemplate
debug.class=sunlabs.brazil.template.DebugTemplate
debug.debug=1

# local cusomizations

sounds=cowbell bark bird bong break clink cow cuckoo duck frog gong ouch splat

# idle timer (in minutes)

idle=30
