mirror of
https://git.wownero.com/lza_menace/wowstash.git
synced 2024-08-15 00:33:15 +00:00
add elasticsearch bypass
This commit is contained in:
parent
cede7269d0
commit
10298ced8f
2 changed files with 17 additions and 15 deletions
|
@ -37,6 +37,7 @@ DB_PASS = 'zzzzzzzzz'
|
|||
|
||||
# Development
|
||||
TEMPLATES_AUTO_RELOAD = True
|
||||
ELASTICSEARCH_ENABLED = False
|
||||
|
||||
# Social
|
||||
SOCIAL = {
|
||||
|
|
|
@ -4,18 +4,19 @@ from wowstash import config
|
|||
|
||||
|
||||
def send_es(data):
|
||||
try:
|
||||
es = Elasticsearch(
|
||||
[getattr(config, 'ELASTICSEARCH_HOST', 'localhost')]
|
||||
)
|
||||
now = datetime.utcnow()
|
||||
index_ts = now.strftime('%Y%m%d')
|
||||
data['datetime'] = now
|
||||
es.index(
|
||||
index="{}-{}".format(
|
||||
getattr(config, 'ELASTICSEARCH_INDEX_NAME', 'wowstash'),
|
||||
index_ts
|
||||
), body=data)
|
||||
except Exception as e:
|
||||
print('Could not capture event in Elasticsearch: ', e)
|
||||
pass # I don't really care if this logs...
|
||||
if getattr(config, 'ELASTICSEARCH_ENABLED', False):
|
||||
try:
|
||||
es = Elasticsearch(
|
||||
[getattr(config, 'ELASTICSEARCH_HOST', 'localhost')]
|
||||
)
|
||||
now = datetime.utcnow()
|
||||
index_ts = now.strftime('%Y%m%d')
|
||||
data['datetime'] = now
|
||||
es.index(
|
||||
index="{}-{}".format(
|
||||
getattr(config, 'ELASTICSEARCH_INDEX_NAME', 'wowstash'),
|
||||
index_ts
|
||||
), body=data)
|
||||
except Exception as e:
|
||||
print('Could not capture event in Elasticsearch: ', e)
|
||||
pass # I don't really care if this logs...
|
||||
|
|
Loading…
Reference in a new issue