diff --git a/dataimporter/importer.py b/dataimporter/importer.py index 47a1ea5..c17747f 100644 --- a/dataimporter/importer.py +++ b/dataimporter/importer.py @@ -63,7 +63,9 @@ def __init__(self, config: Config): self.config = config # client for mongo and elasticsearch via Splitgill self.client = SplitgillClient( - config.get_mongo_client(), config.get_elasticsearch_client() + config.get_mongo_client(), + config.get_elasticsearch_client(), + config.get_mongo_database_name(), ) # make sure the data path exists diff --git a/dataimporter/lib/config.py b/dataimporter/lib/config.py index 3910fbc..d88c3f2 100644 --- a/dataimporter/lib/config.py +++ b/dataimporter/lib/config.py @@ -19,6 +19,7 @@ def get_client(self) -> Elasticsearch: class MongoConfig: host: str = "localhost" port: int = 27017 + database: str = "sg" def get_client(self) -> MongoClient: return MongoClient(self.host, self.port) @@ -60,6 +61,9 @@ def get_elasticsearch_client(self) -> Elasticsearch: def get_mongo_client(self) -> MongoClient: return self.mongo_config.get_client() + def get_mongo_database_name(self) -> str: + return self.mongo_config.database + class ConfigLoadError(Exception): def __init__(self, reason: str):