Spaces:
Running
Running
| import os | |
| from pydantic_settings import BaseSettings | |
| from typing import List, Union | |
| from pydantic import field_validator | |
| class Settings(BaseSettings): | |
| ALLOWED_ORIGINS: Union[str, List[str]] = ["http://localhost:3000"] | |
| def assemble_cors_origins(cls, v): | |
| if isinstance(v, str) and not v.startswith("["): | |
| return [i.strip() for i in v.split(",") if i.strip()] | |
| return v | |
| os.environ["ALLOWED_ORIGINS"] = "http://localhost:3000,http://localhost:8080" | |
| print(Settings().ALLOWED_ORIGINS) | |