Add per-endpoint NPM discovery adapters
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import importlib
|
||||
|
||||
|
||||
def _load(kind: str, name: str, config):
|
||||
def _load(kind: str, name: str, config, *args):
|
||||
if not name or not name.replace("_", "").replace("-", "").isalnum():
|
||||
raise RuntimeError(f"Invalid {kind} plugin name: {name!r}")
|
||||
|
||||
@@ -19,7 +19,7 @@ def _load(kind: str, name: str, config):
|
||||
if plugin_class is None:
|
||||
raise RuntimeError(f"Plugin module {path} does not export Plugin")
|
||||
|
||||
return plugin_class(config)
|
||||
return plugin_class(config, *args)
|
||||
|
||||
|
||||
def load_source(name: str, config):
|
||||
@@ -28,3 +28,7 @@ def load_source(name: str, config):
|
||||
|
||||
def load_provider(name: str, config):
|
||||
return _load("providers", name, config)
|
||||
|
||||
|
||||
def load_adapter(name: str, config, endpoint):
|
||||
return _load("adapters", name, config, endpoint)
|
||||
|
||||
Reference in New Issue
Block a user