Skip to content

Commit 8d2d0bb

Browse files
committed
Update dependencies and refactor MongoDB settings
- Upgraded Poetry version from 1.8.4 to 2.0.1 in `poetry.lock`. - Updated `motor` package version from 3.6.0 to 3.7.1 in `pyproject.toml`. - Refactored MongoDB settings in `settings.py` to rename `DATABASE_NAME` to `MONGO_DATABASE_NAME`. - Adjusted MongoDB client initialization in `main.py` to use the updated setting. - Changed MongoDB URI retrieval in `mongodb.py` to reflect the new property name.
1 parent 35790a4 commit 8d2d0bb

File tree

5 files changed

+134
-120
lines changed

5 files changed

+134
-120
lines changed

app/core/settings.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,13 @@
55

66

77
class Settings(BaseSettings):
8-
# Security Settings
9-
SECRET_KEY: str
8+
# Security Settings (JWT)
9+
SECRET_KEY: str = "secret-key"
1010
ALGORITHM: str = "HS256"
1111
ACCESS_TOKEN_EXPIRE_MINUTES: int = 480
1212

13-
# Azure Settings
14-
AZURE_ENDPOINT: str
15-
AZURE_KEY: str
16-
AZURE_OPENAI_ENDPOINT: str
17-
AZURE_OPENAI_KEY: str
18-
AZURE_OPENAI_VERSION: str
19-
2013
# MongoDB Settings
21-
MONGODB_URI: str = "mongodb://localhost:27017"
22-
DATABASE_NAME: str = "database"
14+
MONGO_DATABASE_NAME: str = "database"
2315
MONGO_USERNAME: str = "admin"
2416
MONGO_PASSWORD: str = ""
2517
MONGO_HOST: str = "localhost"
@@ -28,10 +20,6 @@ class Settings(BaseSettings):
2820
# Redis Settings
2921
REDIS_URL: str = "redis://localhost:6379/0"
3022

31-
# Google OAuth Settings
32-
GOOGLE_CLIENT_ID: str
33-
GOOGLE_CLIENT_SECRET: str
34-
3523
# RabbitMQ Settings
3624
RABBITMQ_HOST: str = "localhost"
3725
RABBITMQ_PORT: int = 5672
@@ -46,7 +34,7 @@ def RABBITMQ_URL(self) -> str:
4634
return f"amqp://{self.RABBITMQ_USERNAME}:{self.RABBITMQ_PASSWORD}@{self.RABBITMQ_HOST}:{self.RABBITMQ_PORT}/{self.RABBITMQ_VHOST}"
4735

4836
@property
49-
def MONGODB_URL(self) -> str:
37+
def MONGODB_URI(self) -> str:
5038
if not self.MONGO_PASSWORD:
5139
return f"mongodb://{self.MONGO_HOST}:{self.MONGO_PORT}"
5240

app/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async def lifespan(app: FastAPI):
2020

2121
# Initialize MongoDB client
2222
app.mongodb_client = get_mongodb_client()
23-
app.db = app.mongodb_client[settings.DATABASE_NAME]
23+
app.db = app.mongodb_client[settings.MONGO_DATABASE_NAME]
2424

2525
# Initialize RabbitMQ connection
2626
app.rabbitmq_connection = await get_rabbitmq_connection()

app/utils/mongodb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
def get_mongodb_client():
99
settings = get_settings()
10-
mongo_uri = settings.MONGODB_URL
10+
mongo_uri = settings.MONGODB_URI
1111

1212
return AsyncIOMotorClient(mongo_uri)

0 commit comments

Comments
 (0)