diff --git a/monkey/monkey_island/cc/models/__init__.py b/monkey/monkey_island/cc/models/__init__.py index 673b6454a..8db8c6f23 100644 --- a/monkey/monkey_island/cc/models/__init__.py +++ b/monkey/monkey_island/cc/models/__init__.py @@ -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