Skip to content

Commit

Permalink
Merge pull request #2 from Safecast/add-back-es-host
Browse files Browse the repository at this point in the history
Added back ELASTICSEARCH_HOST.
  • Loading branch information
matschaffer authored Sep 13, 2020
2 parents d6e3ecd + 8de37fe commit 1678411
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
def get_data():
config = configparser.ConfigParser()
config.read('config.ini')
es = Elasticsearch('https://{}:{}@40ad140d461d810ac41ed710b5c7a5b6.us-west-2.aws.found.io:9243/'.format(config['ELASTICSEARCH']['Username'], config['ELASTICSEARCH']['Password']))

host = os.environ.get('ELASTICSEARCH_HOST')
if host is None:
host = 'https://{}:{}@40ad140d461d810ac41ed710b5c7a5b6.us-west-2.aws.found.io:9243/'.format(
config['ELASTICSEARCH']['Username'], config['ELASTICSEARCH']['Password'])
es = Elasticsearch(host)

# query
week_ago = date.today() - timedelta(days=7)
Expand Down Expand Up @@ -48,4 +53,4 @@ def filter():
return render_template('map.html', data=data)

if __name__ == "__main__":
app.run(debug=True)
app.run(debug=True)

0 comments on commit 1678411

Please sign in to comment.