throw an error if the env file is missing
This commit is contained in:
parent
a3587f80a6
commit
9820bb5069
@ -6,6 +6,8 @@ from types import MappingProxyType
|
|||||||
def get_cfg(env='qa'):
|
def get_cfg(env='qa'):
|
||||||
environment_name = os.getenv('ENV_NAME', env)
|
environment_name = os.getenv('ENV_NAME', env)
|
||||||
dotenv_path = f'.env.{environment_name}'
|
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)
|
load_dotenv(dotenv_path)
|
||||||
|
|
||||||
config_dict = {
|
config_dict = {
|
||||||
|
Loading…
Reference in New Issue
Block a user