File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed
Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change 1- from typing import Annotated , Any
2-
3- from pydantic import AnyHttpUrl , BeforeValidator
1+ from pydantic import AnyHttpUrl
42from pydantic_settings import BaseSettings
53
64
7- def parse_cors (v : Any ) -> list [str ] | str :
8- if isinstance (v , str ) and not v .startswith ("[" ):
9- return [i .strip () for i in v .split ("," )]
10- elif isinstance (v , list | str ):
11- return v
12- raise ValueError (v )
13-
14-
155class Settings (BaseSettings ):
166 PROJECT_NAME : str = "JSONed"
177 API_V1_STR : str = "/api/v1"
18- BACKEND_CORS_ORIGINS : Annotated [
19- list [AnyHttpUrl ] | str , BeforeValidator (parse_cors )
20- ] = ["http://localhost" , "http://localhost:3000" ]
8+ BACKEND_CORS_ORIGINS : list [AnyHttpUrl ] = [
9+ "http://localhost" ,
10+ "http://localhost:3000" ,
11+ ]
2112
2213
2314settings = Settings ()
You can’t perform that action at this time.
0 commit comments