Adding chtlawfirm to the api
This commit is contained in:
21
api/rpk-api/firm/db.py
Normal file
21
api/rpk-api/firm/db.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
|
||||
import motor.motor_asyncio
|
||||
|
||||
MONGO_USERNAME = os.getenv("MONGO_INITDB_ROOT_USERNAME")
|
||||
MONGO_PASSWORD = os.getenv("MONGO_INITDB_ROOT_PASSWORD")
|
||||
|
||||
DATABASE_URL = f"mongodb://{MONGO_USERNAME}:{MONGO_PASSWORD}@mongo:27017"
|
||||
|
||||
client = motor.motor_asyncio.AsyncIOMotorClient(
|
||||
DATABASE_URL, uuidRepresentation="standard"
|
||||
)
|
||||
|
||||
async def init_db():
|
||||
pass
|
||||
|
||||
async def stop_db():
|
||||
client.close()
|
||||
|
||||
def get_db_client():
|
||||
yield client
|
||||
Reference in New Issue
Block a user