mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[V3 Config] Correct Mongo connection URI without credentials (#1362)
* Correct connection string without credentials * Remove extra whitespace.
This commit is contained in:
parent
ed5945e182
commit
b10b746d9e
@ -14,10 +14,15 @@ def _initialize(**kwargs):
|
|||||||
admin_pass = kwargs['PASSWORD']
|
admin_pass = kwargs['PASSWORD']
|
||||||
db_name = kwargs.get('DB_NAME', 'default_db')
|
db_name = kwargs.get('DB_NAME', 'default_db')
|
||||||
|
|
||||||
|
if admin_user is not None and admin_pass is not None:
|
||||||
url = "mongodb://{}:{}@{}:{}/{}".format(
|
url = "mongodb://{}:{}@{}:{}/{}".format(
|
||||||
admin_user, admin_pass, host, port,
|
admin_user, admin_pass, host, port,
|
||||||
db_name
|
db_name
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
url = "mongodb://{}:{}/{}".format(
|
||||||
|
host, port, db_name
|
||||||
|
)
|
||||||
|
|
||||||
global _conn
|
global _conn
|
||||||
_conn = motor.motor_asyncio.AsyncIOMotorClient(url)
|
_conn = motor.motor_asyncio.AsyncIOMotorClient(url)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user