Use location info to handle CouchDB URL

This will need to be much smarter at some point.