WIP getting context-sensitive configs working

Most of the tests from Olaf now pass and the configs are context
sensitive. We will open the database more than once if it is
specified separately in different contexts, but this is fixable.