()
Loads .env file into sys.environ.
Loads .env file into sys.environ.
Loads . env file into sys . environ .
def load_dot_env() -> None:
    """Loads .env file into sys.environ."""
    dont_load_env = os.getenv("GITGUARDIAN_DONT_LOAD_ENV", False)
    dotenv_path = os.getenv("GITGUARDIAN_DOTENV_PATH", None)
    cwd_env = os.path.join(".", ".env")
    if not dont_load_env:
        if dotenv_path and os.path.isfile(dotenv_path):
            load_dotenv(dotenv_path, override=True)
            return
        elif dotenv_path:
            display_error(
                "GITGUARDIAN_DOTENV_LOCATION does not point to a valid .env file"
            )
        if os.path.isfile(cwd_env):
            load_dotenv(cwd_env, override=True)
            return
        if is_git_dir() and os.path.isfile(os.path.join(get_git_root(), ".env")):
            load_dotenv(os.path.join(get_git_root(), ".env"), override=True)
            return
def load_dot_env ( ) -> None : dont_load_env = os . getenv ( "GITGUARDIAN_DONT_LOAD_ENV" , False ) dotenv_path = os . getenv ( "GITGUARDIAN_DOTENV_PATH" , None ) cwd_env = os . path . join ( "." , ".env" ) if not dont_load_env : if dotenv_path and os . path . isfile ( dotenv_path ) : load_dotenv ( dotenv_path , override = True ) return elif dotenv_path : display_error ( "GITGUARDIAN_DOTENV_LOCATION does not point to a valid .env file" ) if os . path . isfile ( cwd_env ) : load_dotenv ( cwd_env , override = True ) return if is_git_dir ( ) and os . path . isfile ( os . path . join ( get_git_root ( ) , ".env" ) ) : load_dotenv ( os . path . join ( get_git_root ( ) , ".env" ) , override = True ) return