v1
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
from pydantic_settings import BaseSettings
|
||||
from pydantic import field_validator
|
||||
from typing import List
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
DATABASE_URL: str = "postgresql+asyncpg://postgres:postgres@localhost:5432/goodwalk"
|
||||
SECRET_KEY: str = "change-me-to-a-long-random-secret"
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES: int = 15
|
||||
REFRESH_TOKEN_EXPIRE_DAYS: int = 7
|
||||
ALGORITHM: str = "HS256"
|
||||
ALLOWED_ORIGINS: str = "http://localhost:5173,https://www.goodwalk.co.nz"
|
||||
ENABLE_DOCS: bool = False
|
||||
SITE_URL: str = "http://localhost:5173"
|
||||
MEMBERS_URL: str = "http://localhost:5173/members"
|
||||
|
||||
# Email — set EMAIL_BACKEND=console (default) to print to stdout during dev
|
||||
EMAIL_BACKEND: str = "console"
|
||||
SMTP_HOST: str = ""
|
||||
SMTP_PORT: int = 587
|
||||
SMTP_USE_TLS: bool = True
|
||||
SMTP_USER: str = ""
|
||||
SMTP_PASSWORD: str = ""
|
||||
EMAIL_FROM: str = "noreply@goodwalk.co.nz"
|
||||
|
||||
@field_validator("ALLOWED_ORIGINS", mode="before")
|
||||
@classmethod
|
||||
def parse_allowed_origins(cls, v: str) -> str:
|
||||
# Keep as string; we parse to list via property
|
||||
return v
|
||||
|
||||
@property
|
||||
def allowed_origins_list(self) -> List[str]:
|
||||
return [origin.strip() for origin in self.ALLOWED_ORIGINS.split(",") if origin.strip()]
|
||||
|
||||
model_config = {"env_file": ".env", "extra": "ignore"}
|
||||
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user