Added documentation about mongo connection setup

This commit is contained in:
Shay Nehmad 2019-05-07 15:58:44 +03:00
parent 00a4ffd028
commit dc8f9294cd
1 changed files with 5 additions and 2 deletions

View File

@ -1,14 +1,17 @@
from mongoengine import connect
# set up the DB connection.
from monkey_island.cc.environment.environment import env
# This section sets up the DB connection according to the environment.
# If testing, use mongomock which only emulates mongo. for more information, see
# http://docs.mongoengine.org/guide/mongomock.html .
# Otherwise, use an actual mongod instance with connection parameters supplied by env.
if env.testing:
connect('mongoenginetest', host='mongomock://localhost')
else:
connect(db=env.mongo_db_name, host=env.mongo_db_host, port=env.mongo_db_port)
# Order or importing matters, for registering the embedded and referenced documents before using them.
# Order or importing matters here, for registering the embedded and referenced documents before using them.
from config import Config
from creds import Creds
from monkey_ttl import MonkeyTtl