File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 1010
1111async def connect_to_mongo ():
1212 global client , database , _schemas_collection
13+
1314 client = AsyncIOMotorClient (settings .MONGO_URI )
14- database = client .jsoned_db
15- _schemas_collection = database .schemas
15+ database = client [settings .MONGO_DB_NAME ]
16+ _schemas_collection = database [settings .SCHEMAS_COLLECTION_NAME ]
17+
1618 await _schemas_collection .create_index ("title" , unique = True )
1719
1820
Original file line number Diff line number Diff line change 55class Settings (BaseSettings ):
66 PROJECT_NAME : str = "JSONed"
77 API_V1_STR : str = "/api/v1"
8+
9+ MONGO_URI : str = "mongodb://localhost:27017"
10+ MONGO_DB_NAME : str = "jsoned_db"
11+ SCHEMAS_COLLECTION_NAME : str = "schemas"
12+
813 BACKEND_CORS_ORIGINS : list [AnyHttpUrl ] = [
914 "http://localhost" ,
1015 "http://localhost:3000" ,
1116 ]
12- MONGO_URI : str = "mongodb://localhost:27017"
1317
1418
1519settings = Settings ()
You can’t perform that action at this time.
0 commit comments