zut.config.load_dotenv
- zut.config.load_dotenv(path: PathLike | str | None = None, *, encoding='utf-8', override=False, parents=False)
Load .env from the given or current directory (or the given file if any) to environment variables. If the given file is a directory, search .env in this directory. If parents is True, also search if parent directories until a .env file is found.
Usage example:
` # Load configuration files load_dotenv() # load `.env` in the current working directory load_dotenv(os.path.dirname(__file__), parents=True) # load `.env` in the Python module installation directory or its parents load_dotenv(f'C:\ProgramData\my-app\my-app.env' if sys.platform == 'win32' else f'/etc/my-app/my-app.env') # load `.env` in the system configuration directory `