re-factor configuration

Now take database URI from DATABASE_URI environment variable. We'll just
have to remember not to run tests on production.