diff --git a/base_configs.py b/base_configs.py index 8d1337e..ce1e8b5 100644 --- a/base_configs.py +++ b/base_configs.py @@ -8,7 +8,6 @@ # Database Configs DB_HOST = "localhost" -DB_PORT = 27017 DB_NAME = "database_name" DB_USER = "Cool Name" DB_PASSWORD = "Secure Password" diff --git a/bot/db/services/base_service.py b/bot/db/services/base_service.py index 1f6e17a..37d08e9 100644 --- a/bot/db/services/base_service.py +++ b/bot/db/services/base_service.py @@ -42,10 +42,10 @@ def conn(self) -> Database: """Return a connection to the database.""" if self.__conn is None: self.__conn = MongoClient( - host=configs.DB_HOST, - username=configs.DB_USER, - password=configs.DB_PASSWORD, - authMechanism="SCRAM-SHA-256", + "mongodb+srv://" + + f"{configs.DB_USER}:{configs.DB_PASSWORD}" + + f"@{configs.DB_HOST}/" + + "?retryWrites=true&w=majority&ssl=true", ).get_database(configs.DB_NAME) return self.__conn diff --git a/requirements.txt b/requirements.txt index 2a22850..3e2799f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ discord.py[speed] jsonpickle -pymongo +pymongo[srv] # Linter pylint