mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
default mongo url is accessible with method
This commit is contained in:
parent
f2ecff2688
commit
355872938b
1 changed files with 5 additions and 1 deletions
|
|
@ -137,10 +137,14 @@ class PypeMongoConnection:
|
||||||
mongo_clients = {}
|
mongo_clients = {}
|
||||||
log = logging.getLogger("PypeMongoConnection")
|
log = logging.getLogger("PypeMongoConnection")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_default_mongo_url():
|
||||||
|
return os.environ["PYPE_MONGO"]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_mongo_client(cls, mongo_url=None):
|
def get_mongo_client(cls, mongo_url=None):
|
||||||
if mongo_url is None:
|
if mongo_url is None:
|
||||||
mongo_url = os.environ["PYPE_MONGO"]
|
mongo_url = cls.get_default_mongo_url()
|
||||||
|
|
||||||
connection = cls.mongo_clients.get(mongo_url)
|
connection = cls.mongo_clients.get(mongo_url)
|
||||||
if connection:
|
if connection:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue