mirror of
https://github.com/alerta/alerta.git
synced 2025-01-24 17:29:39 +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
12 lines
419 B
Python
12 lines
419 B
Python
from alerta.database.backends.postgres import Backend as PGBackend
|
|
|
|
|
|
class Backend(PGBackend):
|
|
|
|
def create_engine(self, app, uri, dbname=None, raise_on_error=True):
|
|
uri = f"postgresql://{uri.split('://')[1]}"
|
|
super().create_engine(app, uri, dbname, raise_on_error)
|
|
|
|
def create_alert(self, alert):
|
|
alert.attributes['custom_attribute'] = 'value'
|
|
return super().create_alert(alert)
|