♻️ Simplify domains with api.example.com for API and dashboard.example.com for frontend, improve local development with localhost (#1344)

This commit is contained in:
Sebastián Ramírez
2024-09-19 20:11:33 +02:00
committed by GitHub
parent 110a59c71d
commit 79d240f5b7
11 changed files with 153 additions and 149 deletions

View File

@@ -31,17 +31,9 @@ class Settings(BaseSettings):
SECRET_KEY: str = secrets.token_urlsafe(32)
# 60 minutes * 24 hours * 8 days = 8 days
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8
DOMAIN: str = "localhost"
FRONTEND_HOST: str = "http://localhost:5173"
ENVIRONMENT: Literal["local", "staging", "production"] = "local"
@computed_field # type: ignore[prop-decorator]
@property
def server_host(self) -> str:
# Use HTTPS for anything other than local development
if self.ENVIRONMENT == "local":
return f"http://{self.DOMAIN}"
return f"https://{self.DOMAIN}"
BACKEND_CORS_ORIGINS: Annotated[
list[AnyUrl] | str, BeforeValidator(parse_cors)
] = []