Plugin Configuration

Web UI for runtime plugin management. A private section of the ServerApplication, attached under plugins when the config recipe declares server(plugins=True), so its endpoints live under /_server/plugins/.

Note: /_server/plugins is this configurator URL section, not genro_asgi.plugins (the genro-routes plugin package).

Section

Plugin Configuration UI - a section of the ServerApplication.

Provides a Swagger-like interface to navigate the routing tree and configure plugins at router-level (_all_) and entry-level.

This is a private section of the server, not a separately mounted app. When the config recipe declares root.server(plugins=True) the server attaches this section to its already-mounted ServerApplication under the plugins alias, so the endpoints live under /_server/plugins/.

Terminology: /_server/plugins (this configurator UI section) is NOT src/genro_asgi/plugins/ (the package of genro-routes plugins). The former is a URL section; the latter is Python code.

Endpoints (relative to /_server/plugins/):

/: Index page with plugin configuration UI. /static: Static resource serving (JS files). /tree: JSON routing tree with plugin_info. /plugins: Available plugins with configure() signatures. /config: Read plugin configuration for a node. /apply: Apply a config change at runtime (no persistence). /save: Persist current runtime config to plugin_config.json. /revert: Reload config from plugin_config.json, discarding runtime changes. /logs: Read captured log entries. /clear_logs: Clear the captured log buffer.

class genro_asgi.server.server_applications.plugin_config.plugin_config.PluginConfigSection(application)[source]

Bases: RoutingClass

Plugin configuration web UI, a section of the ServerApplication.

Attached under plugins on the ServerApplication, so its endpoints live under /_server/plugins/. Persistence logic (load/save/apply plugin_config.json) lives on AsgiServer; this section is a thin GUI layer that delegates to server methods.

Note

Parent (dual relationship): the ServerApplication, stored as self.application. The AsgiServer is reached via self.application.server.

__init__(application)[source]

Initialize the section and bind it to its ServerApplication.

Parameters:

application (ServerApplication) – The ServerApplication this section belongs to (dual relationship). The AsgiServer is application.server.

apply(router_path='', plugin_name='', target='_all_', **config_values)[source]

Apply a plugin config change at runtime without persisting.

Parameters:
  • router_path (str) – Dotted path to the router (empty = root).

  • plugin_name (str) – Name of the plugin to configure.

  • target (str) – Target slot (“_all_” or specific entry name).

  • **config_values (Any) – Plugin configuration key-value pairs.

Returns:

True on success, or “error” key on failure.

Return type:

dict[str, Any]

clear_logs()[source]

Clear the log buffer.

Returns:

True.

Return type:

dict[str, Any]

config(router_path='', entry='')[source]

Read plugin configuration for a specific router/entry.

Parameters:
  • router_path (str) – Dotted path to the router (empty = root).

  • entry (str) – Specific entry/handler name to filter (empty = all).

Return type:

dict[str, Any]

Returns:

Dict with router_path, plugin_info. Error dict if router not found.

index()[source]

Serve the plugin configuration page.

Return type:

str

logs(entry='', since='0', limit=100)[source]

Return captured log entries, optionally filtered by entry name.

Parameters:
  • entry (str) – Filter by entry/handler name (empty = all).

  • since (str) – Timestamp filter - only logs after this time.

  • limit (int) – Max entries to return.

Return type:

dict[str, Any]

Returns:

Dict with “logs” list and “server_time” timestamp.

plugins()[source]

Return available plugins with their configure() signatures.

Return type:

dict[str, Any]

Returns:

Dict with “plugins” key mapping plugin names to description and params.

revert()[source]

Revert runtime config to what is saved in plugin_config.json.

Returns:

True. Includes “message” if no saved config exists.

Return type:

dict[str, Any]

save()[source]

Persist current runtime plugin config to plugin_config.json.

Returns:

True and “file” path on success.

Return type:

dict[str, Any]

property server: Any

The AsgiServer, reached through the parent ServerApplication.

static(file='')[source]

Serve a static JS resource from this section’s resources directory.

Parameters:

file (str) – Resource filename (e.g. “tree.js”). Must be a plain name within resources/ — path traversal is rejected.

Raises:

HTTPNotFound – If the file name is unsafe or the file is missing.

Return type:

Any

tree()[source]

Return the routing tree with plugin_info for each router.

Return type:

dict[str, Any]

Returns:

Serialized routing tree dict with entries, routers, plugin_info.