-
Notifications
You must be signed in to change notification settings - Fork 297
/
json_log_omm_config.py
79 lines (69 loc) · 2.52 KB
/
json_log_omm_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright (c) Meta Platforms, Inc. and affiliates.
"""
A development version of an omm_config, with every field visible and commented.
This configuration is identical to development_omm_config.py, except that it
enables json log formatting.
"""
import logging
from logging.config import dictConfig
from OpenMediaMatch.storage.postgres.impl import DefaultOMMStore
from OpenMediaMatch.utils.fetch_benchmarking import InfiniteRandomExchange
from OpenMediaMatch.utils.formatters import CustomJsonFormatter
from threatexchange.signal_type.pdq.signal import PdqSignal
from threatexchange.signal_type.md5 import VideoMD5Signal
from threatexchange.content_type.photo import PhotoContent
from threatexchange.content_type.video import VideoContent
from threatexchange.exchanges.impl.static_sample import StaticSampleSignalExchangeAPI
from threatexchange.exchanges.impl.ncmec_api import NCMECSignalExchangeAPI
from threatexchange.exchanges.impl.stop_ncii_api import StopNCIISignalExchangeAPI
from threatexchange.exchanges.impl.fb_threatexchange_api import (
FBThreatExchangeSignalExchangeAPI,
)
# Database configuration
DBUSER = "media_match"
DBPASS = "hunter2"
DBHOST = "db"
DBNAME = "media_match"
DATABASE_URI = f"postgresql+psycopg2://{DBUSER}:{DBPASS}@{DBHOST}/{DBNAME}"
# Role configuration
PRODUCTION = False
ROLE_HASHER = True
ROLE_MATCHER = True
ROLE_CURATOR = True
# APScheduler (background threads for development)
TASK_FETCHER = True
TASK_INDEXER = True
TASK_INDEX_CACHE = True
# Core functionality configuration
STORAGE_IFACE_INSTANCE = DefaultOMMStore(
signal_types=[PdqSignal, VideoMD5Signal],
content_types=[PhotoContent, VideoContent],
exchange_types=[
StaticSampleSignalExchangeAPI,
InfiniteRandomExchange, # type: ignore
FBThreatExchangeSignalExchangeAPI, # type: ignore
NCMECSignalExchangeAPI, # type: ignore
StopNCIISignalExchangeAPI,
],
)
FLASK_LOGGING_CONFIG = dictConfig(
{
"version": 1,
"formatters": {
"default": {
"format": "[%(asctime)s] %(levelname)s in %(module)s: %(message)s",
},
"json": {"()": "OpenMediaMatch.utils.formatters.CustomJsonFormatter"},
},
"handlers": {
"wsgi": {
"class": "logging.StreamHandler",
"stream": "ext://flask.logging.wsgi_errors_stream",
"formatter": "json",
}
},
"root": {"level": "INFO", "handlers": ["wsgi"]},
}
)
# Debugging stuff
# SQLALCHEMY_ENGINE_LOG_LEVEL = logging.INFO