Enhancement: move db/env stuff into a library

Added a test case to confirm my assumptions.
Updated recipes for gocourse api and management.
Applied 'default' to api.