Skip to content

Commit

Permalink
Add disable notifications config option (#189)
Browse files Browse the repository at this point in the history
This adds a configuration option to disable notifications.

Fix #181

Signed-off-by: David Brown <dmlb2000@gmail.com>
  • Loading branch information
dmlb2000 committed Jan 30, 2019
1 parent d8b5f86 commit 8c1da5f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ debug_logging = False
[notifications]
; This section describes where the notifications server is.

; Disable eventing for the metadata service.
disabled = False

; URL to the recieve endpoint on the notifications server.
url = http://127.0.0.1:8070/receive

Expand Down
2 changes: 2 additions & 0 deletions pacifica/metadata/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def get_config():
configparser.set('database', 'peewee_url', getenv(
'PEEWEE_URL', 'postgresql://pacifica:metadata@localhost:5432/pacifica_metadata'))
configparser.add_section('notifications')
configparser.set('notifications', 'disabled', getenv(
'NOTIFICATIONS_DISABLED', 'False'))
configparser.set('notifications', 'url', getenv(
'NOTIFICATIONS_URL', 'http://127.0.0.1:8070/receive'))
configparser.add_section('elasticsearch')
Expand Down
3 changes: 2 additions & 1 deletion pacifica/metadata/rest/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,5 +243,6 @@ def emit_event(json):
Files()._insert(extract_files(request.json))
FileKeyValue()._insert(generate_fkvs(request.json))
# pylint: enable=protected-access
emit_event(request.json)
if not get_config().getboolean('notifications', 'disabled'):
emit_event(request.json)
return {'status': 'success'}

0 comments on commit 8c1da5f

Please sign in to comment.