Move config functionality into the config API, write config API tests