added checks to db uri and environment detection