throw an error if the env file is missing

This commit is contained in:
Greg Gauthier 2024-07-20 09:33:19 +01:00
parent a3587f80a6
commit 9820bb5069

View File

@ -6,6 +6,8 @@ from types import MappingProxyType
def get_cfg(env='qa'):
environment_name = os.getenv('ENV_NAME', env)
dotenv_path = f'.env.{environment_name}'
if not os.path.exists(dotenv_path):
raise FileNotFoundError(f"{dotenv_path} does not exist")
load_dotenv(dotenv_path)
config_dict = {