Configuración (settings)¶
Cada plugin declara ajustes en configuration/manifest.json. El framework carga el archivo en boot y expone un árbol género → segmento → widgets en /admin/configuration.
Cuándo usar¶
parameters: valores escalares por tenant (flags, textos, números) persistidos en el store de settings.parameter_table: catálogo pequeño de filas del plugin (resource ligero) con CRUD vía API del plugin.
Manifest por plugin¶
Ruta fija: cortex_plugin_<id>/configuration/manifest.json.
{
"panelId": "admin",
"pluginId": "booking",
"groups": [
{ "id": "operations", "label": "Operaciones", "navSort": 20 }
],
"segments": [
{
"id": "booking",
"title": "Reservas",
"group": "operations",
"navSort": 10,
"description": "Ajustes del módulo de reservas.",
"widgets": [
{
"type": "parameters",
"groupLabel": "General",
"fields": [
{ "name": "allow_overbooking", "type": "toggle", "title": "Permitir overbooking" }
]
}
]
}
]
}
Los géneros se fusionan entre plugins (como navGroups en recursos). Un segmento puede apilar varios widgets (parameters + parameter_table).
Referencia: plugins/booking/cortex_plugin_booking/configuration/manifest.json.
API HTTP¶
| Método | Ruta |
|---|---|
GET | /api/v1/settings/panels/{panelId} — árbol { groups, segments } |
GET | /api/v1/settings/panels/{panelId}/{segmentId} — valores de widgets parameters |
PUT | /api/v1/settings/panels/{panelId}/{segmentId} — actualizar solo segmentos con widgets parameters |
Las tablas (parameter_table) persisten fila a fila contra las rutas declaradas en el manifest (listPath, createPath, itemPath).
Backend de persistencia escalar: CORTEX_PLATFORM_SETTINGS_BACKEND (memory o postgres). Ver persistencia.
El widget settings en el shell consume estas rutas (/admin/configuration).
Validación¶
- Boot: schema ligero + unicidad de
namede campos por segmento. PUT: solo claves declaradas en widgetsparameters; segmentos solo-tabla devuelven405.
Deprecado¶
register_settings + SettingsBuilder en extensions.py queda como shim si no hay manifest; en plugins nuevos usar solo el JSON.