Skip to content

Commit

Permalink
Set Mongo vars to None
Browse files Browse the repository at this point in the history
  • Loading branch information
WinnyTroy committed Mar 11, 2021
1 parent de4b7e7 commit f5249bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,4 @@ django_environment_vars:
web_page_title: "Ona"
kpi_raven_frontend_env: ""
kpi_raven_backend_env: ""
kpi_enable_mongo_connection: false
5 changes: 5 additions & 0 deletions templates/kpi/settings.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,11 @@ if MONGO_DATABASE.get('USER') and MONGO_DATABASE.get('PASSWORD'):
else:
MONGO_CONNECTION_URL = "mongodb://%(HOST)s:%(PORT)s" % MONGO_DATABASE

{% if kpi_enable_mongo_connection %}
MONGO_CONNECTION = MongoClient(
MONGO_CONNECTION_URL, j=True, tz_aware=True, connect=False)
MONGO_DB = MONGO_CONNECTION[MONGO_DATABASE['NAME']]
{% else %}
MONGO_CONNECTION = None
MONGO_DB = None
{% endif %}

0 comments on commit f5249bc

Please sign in to comment.