From: Juan Date: Wed, 21 Nov 2018 15:21:34 +0000 (-0300) Subject: added env vars for mongo ha X-Git-Tag: v5.0.0~2^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F37%2F6937%2F2;p=osm%2FPOL.git added env vars for mongo ha Change-Id: Ied541f300e819eacbc31426089eb7ca547b59f34 Signed-off-by: Juan --- diff --git a/docker/Dockerfile b/docker/Dockerfile index 5953489..91bc5f6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -41,8 +41,7 @@ ENV OSMPOL_MESSAGE_HOST kafka ENV OSMPOL_MESSAGE_PORT 9092 ENV OSMPOL_DATABASE_DRIVER mongo -ENV OSMPOL_DATABASE_HOST mongo -ENV OSMPOL_DATABASE_PORT 27017 +ENV OSMPOL_DATABASE_URI mongodb://mongo:27017 ENV OSMPOL_SQL_DATABASE_URI sqlite:///policy_module.db diff --git a/osm_policy_module/common/common_db_client.py b/osm_policy_module/common/common_db_client.py index 83bb46c..41ce975 100644 --- a/osm_policy_module/common/common_db_client.py +++ b/osm_policy_module/common/common_db_client.py @@ -30,8 +30,7 @@ class CommonDbClient: def __init__(self): cfg = Config.instance() self.common_db = dbmongo.DbMongo() - self.common_db.db_connect({'host': cfg.OSMPOL_DATABASE_HOST, - 'port': int(cfg.OSMPOL_DATABASE_PORT), + self.common_db.db_connect({'uri': cfg.OSMPOL_DATABASE_URI, 'name': 'osm'}) def get_vnfr(self, nsr_id: str, member_index: int): diff --git a/osm_policy_module/common/lcm_client.py b/osm_policy_module/common/lcm_client.py index 3d8012f..05378d7 100644 --- a/osm_policy_module/common/lcm_client.py +++ b/osm_policy_module/common/lcm_client.py @@ -42,8 +42,7 @@ class LcmClient: self.kafka_server = '{}:{}'.format(cfg.OSMPOL_MESSAGE_HOST, cfg.OSMPOL_MESSAGE_PORT) self.common_db = dbmongo.DbMongo() - self.common_db.db_connect({'host': cfg.OSMPOL_DATABASE_HOST, - 'port': int(cfg.OSMPOL_DATABASE_PORT), + self.common_db.db_connect({'uri': cfg.OSMPOL_DATABASE_URI, 'name': 'osm'}) if not loop: loop = asyncio.get_event_loop() diff --git a/osm_policy_module/core/config.py b/osm_policy_module/core/config.py index 94dec98..55287cc 100644 --- a/osm_policy_module/core/config.py +++ b/osm_policy_module/core/config.py @@ -63,8 +63,7 @@ class Config(object): CfgParam('OSMPOL_MESSAGE_HOST', "localhost", six.text_type), CfgParam('OSMPOL_MESSAGE_PORT', 9092, int), CfgParam('OSMPOL_DATABASE_DRIVER', "mongo", six.text_type), - CfgParam('OSMPOL_DATABASE_HOST', "mongo", six.text_type), - CfgParam('OSMPOL_DATABASE_PORT', 27017, int), + CfgParam('OSMPOL_DATABASE_URI', "mongodb://mongo:27017", six.text_type), CfgParam('OSMPOL_SQL_DATABASE_URI', "sqlite:///policy_module.db", six.text_type), CfgParam('OSMPOL_LOG_LEVEL', "INFO", six.text_type), CfgParam('OSMPOL_KAFKA_LOG_LEVEL', "WARN", six.text_type),