Commit 7ddea357 authored by Cesuuur's avatar Cesuuur
Browse files

debugging

parent 266bf724
Loading
Loading
Loading
Loading
+23 −6
Original line number Diff line number Diff line
@@ -5,9 +5,11 @@ import os
import logging


logger = logging.getLogger(__name__)  # the __name__ resolve to "uicheckapp.services"
# the __name__ resolve to "uicheckapp.services"
logger = logging.getLogger(__name__)
# This will load the uicheckapp logger


class MongoDatabse():

    def __init__(self):
@@ -34,10 +36,25 @@ class MongoDatabse():
                f"An exception occurred while deleting collection {name}: {e}")

    def __connect(self):
        logger.error(os.getenv('CAPIF_MONGO_USER') + ":" + os.getenv('CAPIF_MONGO_PASSWORD'))
        uri = "mongodb://" + os.getenv('CAPIF_MONGO_USER') + ":" + os.getenv('CAPIF_MONGO_PASSWORD') + \
            "@" + os.getenv('CAPIF_MONGO_HOSTNAME') + \
            ":" + os.getenv('CAPIF_MONGO_PORT')
        mongo_user = os.getenv('CAPIF_MONGO_USER')
        mongo_password = os.getenv('CAPIF_MONGO_PASSWORD')
        mongo_hostname = os.getenv('CAPIF_MONGO_HOSTNAME')
        mongo_port = os.getenv('CAPIF_MONGO_PORT')

        if(mongo_user is None):
            logger.error("CAPIF_MONGO_USER is not set")
        elif (mongo_password is None):
            logger.error("CAPIF_MONGO_PASSWORD is not set")
        elif (mongo_hostname is None):
            logger.error("CAPIF_MONGO_HOSTNAME is not set")
        elif (mongo_port is None):
            logger.error("CAPIF_MONGO_PORT is not set")

        uri = "mongodb://" + mongo_user + ":" + mongo_password + \
            "@" + mongo_hostname + ":" + mongo_port
        
        logger.error(uri)
        
        client = MongoClient(uri)

        try: