mirror of
https://github.com/alerta/alerta.git
synced 2024-12-04 12:57:32 +00:00
c794a04f00
* Support custom backends defined as entry point A custom backend may be needed to support a different database or to extend or modify current backends functionality. With this modification, a custom backend can be defined using an entry point to provide its module location. * Change entry point name for custom backends and include an example |
||
---|---|---|
.. | ||
package | ||
README.md | ||
setup.py |
Custom backends example
Provided example consists of a database backend based on standard PostgreSQL backend.
It has a very basic functionality, adding an attribute to the alert before storing it in the database. This functionality can be achieved using plugins, it is just an example.
Custom backends must provide a class named 'Backend' that implements alerta.database.base.Backend
.
The module providing that class must be referenced as an 'alerta.database.backends' entry-point in python package setup.
...
entry_points={
'alerta.database.backends': [
'custom = package'
]
}
...
To use the custom database backend, the name used for the entry-point has to be used as schema in
DATABASE_URL
configuration setting:
DATABASE_URL = "custom://user@db_server/monitoring?connect_timeout=10&application_name=alerta"