unpluggd/FWRD — Issue #22: Move middleware config to webapp.cfg
Author: unpluggd
Created: 2011-11-10 11:35:06+00:00
State: open
Labels: 0.3, Refactoring

Move `server.py` content:

```python
application.register_middleware(
SessionMiddleware,
opts = {
'session.lock_dir': 'session_lock',
'session.cookie_expires': datetime.datetime.utcnow() + \
datetime.timedelta(hours=session_live_hours),
'session.type': 'ext:memcached',
'session.url': '0.0.0.0:11211',
'session.auto': True,
})
```

to `webapp.cfg`:

```yaml
Middleware:
name: SessionMiddleware
options:
"session.lock_dir": "session_lock"
"session.cookie_expires": datetime.datetime.utcnow() + datetime.timedelta(hours=session_live_hours)
"session.type": 'ext:memcached'
"session.url": '0.0.0.0:11211'
"session.auto": true
```

It might be necessary to parse some content and execute as python code... otherwise users could add middleware directly in python.

It might also be necessary to interpolate the config with variables... eg:

```yaml
Middleware:
name: "CustomMiddleware"
options:
port: "{{config.port}}"
```