Skip to content

Commit 588620a

Browse files
committed
refactor
1 parent 54015ca commit 588620a

File tree

5 files changed

+91
-93
lines changed

5 files changed

+91
-93
lines changed

app/__main__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
if __name__ == "__main__":
99
granian.Granian( # type: ignore[attr-defined]
10-
target="app.application:application",
11-
address="0.0.0.0", # noqa: S104
10+
target="app.application:build_app",
11+
factory=True,
12+
address=settings.app_host,
1213
port=settings.app_port,
1314
interface=Interfaces.ASGI,
1415
log_level=LogLevels(settings.log_level),

app/application.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,3 @@ def build_app() -> fastapi.FastAPI:
3333
exceptions.duplicate_key_error_handler, # type: ignore[arg-type]
3434
)
3535
return app
36-
37-
38-
application = build_app()

app/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Settings(pydantic_settings.BaseSettings):
1515
db_max_overflow: int = 0
1616
db_pool_pre_ping: bool = True
1717

18+
app_host: str = "0.0.0.0" # noqa: S104
1819
app_port: int = 8000
1920

2021
opentelemetry_endpoint: str = ""

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ description = "Async template on FastAPI and SQLAlchemy 2"
55
readme = "README.md"
66
requires-python = ">=3.13"
77
authors = [
8-
{ email = "[email protected]" },
9-
{ name = "Artur Shiriev"}
8+
{ name = "Artur Shiriev", email = "[email protected]" },
109
]
1110
license = "MIT License"
1211
dependencies = [

0 commit comments

Comments
 (0)