Skip to content

Commit

Permalink
Merge pull request #94 from ADEPT-Informatique/fix-mongodb-connection…
Browse files Browse the repository at this point in the history
…-to-atlas

Updated DB connection to work with Atlas
  • Loading branch information
DeveloperAnonymous authored Mar 23, 2023
2 parents 28bdd0d + 0e3e3d2 commit af61d2b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion base_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

# Database Configs
DB_HOST = "localhost"
DB_PORT = 27017
DB_NAME = "database_name"
DB_USER = "Cool Name"
DB_PASSWORD = "Secure Password"
Expand Down
8 changes: 4 additions & 4 deletions bot/db/services/base_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
discord.py[speed]
jsonpickle
pymongo
pymongo[srv]

# Linter
pylint
Expand Down

0 comments on commit af61d2b

Please sign in to comment.