This commit is contained in:
2025-12-23 14:33:25 +01:00
parent 169a759b57
commit cc2f1d0051
6 changed files with 59 additions and 25 deletions

View File

@@ -10,7 +10,8 @@ class Settings(BaseSettings):
DATABASE_URL: str = "postgresql://audio_user:audio_password@localhost:5432/audio_classifier"
# API Configuration
CORS_ORIGINS: str = "http://localhost:3000,http://127.0.0.1:3000"
# Comma-separated list of allowed origins, or use "*" to allow all
CORS_ORIGINS: str = "*"
API_HOST: str = "0.0.0.0"
API_PORT: int = 8000
@@ -33,7 +34,13 @@ class Settings(BaseSettings):
@property
def cors_origins_list(self) -> List[str]:
"""Parse CORS origins string to list."""
"""Parse CORS origins string to list.
If CORS_ORIGINS is "*", allow all origins.
Otherwise, parse comma-separated list.
"""
if self.CORS_ORIGINS.strip() == "*":
return ["*"]
return [origin.strip() for origin in self.CORS_ORIGINS.split(",")]