Spaces:
Running
Running
feat: add signed media URL configuration
Browse files- app/core/config.py +4 -0
app/core/config.py
CHANGED
|
@@ -38,6 +38,8 @@ class Settings(BaseSettings):
|
|
| 38 |
download_timeout_seconds: float = Field(default=300.0, gt=0)
|
| 39 |
allow_private_urls: bool = False
|
| 40 |
base_url: str = ""
|
|
|
|
|
|
|
| 41 |
ffmpeg_binary: str = "ffmpeg"
|
| 42 |
ffprobe_binary: str = "ffprobe"
|
| 43 |
auth_enabled: bool = True
|
|
@@ -253,6 +255,8 @@ class Settings(BaseSettings):
|
|
| 253 |
errors.append("SECURITY_DATABASE_ROLE is required in production")
|
| 254 |
if not self.auth_enabled:
|
| 255 |
errors.append("AUTH_ENABLED must be true in production")
|
|
|
|
|
|
|
| 256 |
if not origins:
|
| 257 |
errors.append("CORS_ALLOWED_ORIGINS must include the HTTPS Vercel frontend origin")
|
| 258 |
elif any(urlparse(origin).scheme != "https" for origin in origins):
|
|
|
|
| 38 |
download_timeout_seconds: float = Field(default=300.0, gt=0)
|
| 39 |
allow_private_urls: bool = False
|
| 40 |
base_url: str = ""
|
| 41 |
+
media_signing_secret: SecretStr | None = None
|
| 42 |
+
media_signed_url_ttl_seconds: int = Field(default=3600, ge=60, le=86_400)
|
| 43 |
ffmpeg_binary: str = "ffmpeg"
|
| 44 |
ffprobe_binary: str = "ffprobe"
|
| 45 |
auth_enabled: bool = True
|
|
|
|
| 255 |
errors.append("SECURITY_DATABASE_ROLE is required in production")
|
| 256 |
if not self.auth_enabled:
|
| 257 |
errors.append("AUTH_ENABLED must be true in production")
|
| 258 |
+
if not self.media_signing_secret or len(self.media_signing_secret.get_secret_value().encode()) < 32:
|
| 259 |
+
errors.append("MEDIA_SIGNING_SECRET must be at least 32 bytes in production")
|
| 260 |
if not origins:
|
| 261 |
errors.append("CORS_ALLOWED_ORIGINS must include the HTTPS Vercel frontend origin")
|
| 262 |
elif any(urlparse(origin).scheme != "https" for origin in origins):
|