Refactored default credentials logic and added an environment credentials provider