Load plugin modules from the default plugin directory or directories specified in the environment variable. If the environment variable `PLUGIN_DIRS_ENV_VAR` is not set, it defaults to `trinity/plugins`.
()
| 12 | |
| 13 | |
| 14 | def load_plugins() -> None: |
| 15 | """ |
| 16 | Load plugin modules from the default plugin directory or directories specified in the environment variable. |
| 17 | If the environment variable `PLUGIN_DIRS_ENV_VAR` is not set, it defaults to `trinity/plugins`. |
| 18 | """ |
| 19 | plugin_dirs = os.environ.get(PLUGIN_DIRS_ENV_VAR, "").split(os.pathsep) |
| 20 | if not plugin_dirs or plugin_dirs == [""]: |
| 21 | plugin_dirs = [str(Path(__file__).parent.parent / "plugins")] |
| 22 | |
| 23 | load_plugin_from_dirs(plugin_dirs) |
| 24 | |
| 25 | |
| 26 | def load_plugin_from_dirs(plugin_dirs: Union[str, List[str]]) -> None: |