import os, ssl
from pymongo import MongoClient

db = None

def get_db():
  global db
  if not db:
    db = MongoClient(os.environ['MONGO_URL'], ssl_cert_reqs = ssl.CERT_NONE)[os.environ['MONGO_DATABASE']]
  return db
