Island: Register StubbedEventRepository in DIContainer

This commit is contained in:
Mike Salvatore 2022-09-14 13:36:55 -04:00
parent f5711e2fab
commit 6f4c3d4669
1 changed files with 5 additions and 0 deletions

View File

@ -25,6 +25,7 @@ from monkey_island.cc.repository import (
IAgentBinaryRepository, IAgentBinaryRepository,
IAgentConfigurationRepository, IAgentConfigurationRepository,
ICredentialsRepository, ICredentialsRepository,
IEventRepository,
IFileRepository, IFileRepository,
ISimulationRepository, ISimulationRepository,
IUserRepository, IUserRepository,
@ -32,6 +33,7 @@ from monkey_island.cc.repository import (
LocalStorageFileRepository, LocalStorageFileRepository,
MongoCredentialsRepository, MongoCredentialsRepository,
RetrievalError, RetrievalError,
StubbedEventRepository,
) )
from monkey_island.cc.server_utils.consts import MONKEY_ISLAND_ABS_PATH from monkey_island.cc.server_utils.consts import MONKEY_ISLAND_ABS_PATH
from monkey_island.cc.server_utils.encryption import ILockableEncryptor, RepositoryEncryptor from monkey_island.cc.server_utils.encryption import ILockableEncryptor, RepositoryEncryptor
@ -106,6 +108,9 @@ def _register_repositories(container: DIContainer, data_dir: Path):
) )
container.register_instance(IUserRepository, container.resolve(JSONFileUserRepository)) container.register_instance(IUserRepository, container.resolve(JSONFileUserRepository))
# TODO: Replace with MongoEventRepository
container.register_instance(IEventRepository, StubbedEventRepository())
def _decorate_file_repository(file_repository: IFileRepository) -> IFileRepository: def _decorate_file_repository(file_repository: IFileRepository) -> IFileRepository:
return FileRepositoryLockingDecorator( return FileRepositoryLockingDecorator(