Loading config.yaml +0 −3 Original line number Diff line number Diff line mongo: { 'user': "root", 'password': "example", 'db': "capif", 'col_invoker': "invokerdetails", 'col_provider': "providerenrolmentdetails", 'col_services': "serviceapidescriptions", Loading db/db.py +2 −2 Original line number Diff line number Diff line Loading @@ -30,14 +30,14 @@ class MongoDatabse(): f"An exception occurred while deleting collection {name}: {e}") def __connect(self): uri = "mongodb://" + self.config['mongo']['user'] + ":" + self.config['mongo']['password'] + \ uri = "mongodb://" + os.getenv('CAPIF_MONGO_USER') + ":" + os.getenv('CAPIF_MONGO_PASSWORD') + \ "@" + os.getenv('CAPIF_MONGO_HOSTNAME') + \ ":" + os.getenv('CAPIF_MONGO_PORT') client = MongoClient(uri) try: client.admin.command("ping") mydb = client[self.config['mongo']['db']] mydb = client[os.getenv('CAPIF_MONGO_NAME')] return mydb except Exception as e: print("An exception occurred ::", e) Loading Loading
config.yaml +0 −3 Original line number Diff line number Diff line mongo: { 'user': "root", 'password': "example", 'db': "capif", 'col_invoker': "invokerdetails", 'col_provider': "providerenrolmentdetails", 'col_services': "serviceapidescriptions", Loading
db/db.py +2 −2 Original line number Diff line number Diff line Loading @@ -30,14 +30,14 @@ class MongoDatabse(): f"An exception occurred while deleting collection {name}: {e}") def __connect(self): uri = "mongodb://" + self.config['mongo']['user'] + ":" + self.config['mongo']['password'] + \ uri = "mongodb://" + os.getenv('CAPIF_MONGO_USER') + ":" + os.getenv('CAPIF_MONGO_PASSWORD') + \ "@" + os.getenv('CAPIF_MONGO_HOSTNAME') + \ ":" + os.getenv('CAPIF_MONGO_PORT') client = MongoClient(uri) try: client.admin.command("ping") mydb = client[self.config['mongo']['db']] mydb = client[os.getenv('CAPIF_MONGO_NAME')] return mydb except Exception as e: print("An exception occurred ::", e) Loading