File tree 3 files changed +10
-15
lines changed
3 files changed +10
-15
lines changed Original file line number Diff line number Diff line change 1
1
import granian
2
2
from granian .constants import Interfaces , Loops
3
+ from granian .log import LogLevels
3
4
4
5
from app .settings import settings
5
6
10
11
address = "0.0.0.0" , # noqa: S104
11
12
port = settings .app_port ,
12
13
interface = Interfaces .ASGI ,
13
- log_level = settings .log_level ,
14
+ log_level = LogLevels ( settings .log_level ) ,
14
15
loop = Loops .uvloop ,
15
16
).serve ()
Original file line number Diff line number Diff line change 1
- import pydantic
2
1
import pydantic_settings
3
- from granian .log import LogLevels
4
2
from sqlalchemy .engine .url import URL
5
3
6
4
@@ -9,7 +7,7 @@ class Settings(pydantic_settings.BaseSettings):
9
7
service_version : str = "1.0.0"
10
8
service_environment : str = "local"
11
9
service_debug : bool = False
12
- log_level : LogLevels = LogLevels . info
10
+ log_level : str = " info"
13
11
14
12
db_driver : str = "postgresql+asyncpg"
15
13
db_host : str = "db"
@@ -30,14 +28,10 @@ class Settings(pydantic_settings.BaseSettings):
30
28
logging_buffer_capacity : int = 0
31
29
swagger_offline_docs : bool = True
32
30
33
- cors_allowed_origins : list [str ] = pydantic .Field (
34
- default_factory = lambda : [
35
- "http://localhost:5173" ,
36
- ]
37
- )
38
- cors_allowed_methods : list [str ] = pydantic .Field (default_factory = lambda : ["" ])
39
- cors_allowed_headers : list [str ] = pydantic .Field (default_factory = lambda : ["" ])
40
- cors_exposed_headers : list [str ] = pydantic .Field (default_factory = list )
31
+ cors_allowed_origins : list [str ] = ["http://localhost:5173" ]
32
+ cors_allowed_methods : list [str ] = ["" ]
33
+ cors_allowed_headers : list [str ] = ["" ]
34
+ cors_exposed_headers : list [str ] = []
41
35
42
36
@property
43
37
def db_dsn (self ) -> URL :
You can’t perform that action at this time.
0 commit comments