Skip to content

Commit

Permalink
Access mongodb with host and port
Browse files Browse the repository at this point in the history
  • Loading branch information
AlberLC committed Jan 20, 2022
1 parent 34303e9 commit 1844cf9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion multibot/models/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

import pymongo

mongo_client = pymongo.MongoClient("localhost", 27017, username=os.environ.get('MONGO_USER'), password=os.environ.get('MONGO_PASSWORD'))
mongo_client = pymongo.MongoClient(
host=os.environ.get('MONGO_HOST'),
port=int(port) if (port := os.environ.get('MONGO_PORT')) else None,
username=os.environ.get('MONGO_USER'),
password=os.environ.get('MONGO_PASSWORD')
)

db = mongo_client.flanabot

0 comments on commit 1844cf9

Please sign in to comment.