mirror of
https://github.com/borgmatic-collective/borgmatic.git
synced 2026-08-07 00:23:20 +02:00
Send tags as array in ntfy monitoring hook.
This commit is contained in:
@@ -22,6 +22,12 @@ def initialize_monitor(
|
||||
'''
|
||||
|
||||
|
||||
def _convert_string_to_array(value):
|
||||
value = str(value or '')
|
||||
|
||||
return [str(item).strip() for item in value.split(',') if str(item).strip()]
|
||||
|
||||
|
||||
PRIORITY_NAME_TO_ID = {
|
||||
'max': 5,
|
||||
'urgent': 5,
|
||||
@@ -66,7 +72,7 @@ def ping_monitor(hook_config, config, config_filename, state, monitoring_log_lev
|
||||
'title': state_config.get('title'),
|
||||
'message': state_config.get('message'),
|
||||
'priority': PRIORITY_NAME_TO_ID.get(state_config.get('priority'), default_priority),
|
||||
'tags': state_config.get('tags'),
|
||||
'tags': _convert_string_to_array(state_config.get('tags')),
|
||||
}
|
||||
|
||||
try:
|
||||
|
||||
@@ -25,7 +25,7 @@ CUSTOM_MESSAGE_PAYLOAD = {
|
||||
'title': CUSTOM_MESSAGE_CONFIG['title'],
|
||||
'message': CUSTOM_MESSAGE_CONFIG['message'],
|
||||
'priority': 1,
|
||||
'tags': CUSTOM_MESSAGE_CONFIG['tags'],
|
||||
'tags': [CUSTOM_MESSAGE_CONFIG['tags']],
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ def default_message_payload(state=Enum):
|
||||
'title': f'A borgmatic {state.name} event happened',
|
||||
'message': f'A borgmatic {state.name} event happened',
|
||||
'priority': 3,
|
||||
'tags': 'borgmatic',
|
||||
'tags': ['borgmatic'],
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user