Commit e0efbad5 authored by Cesuuur's avatar Cesuuur
Browse files

chore: more env vars

parent 0448e413
Loading
Loading
Loading
Loading
+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",
+2 −2
Original line number Diff line number Diff line
@@ -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)