mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2026-02-25 02:20:17 +00:00
✨ api "production" script: invoke granian without "click" hack
This commit is contained in:
parent
ca46a2cf5c
commit
30d1c5fba9
1 changed files with 11 additions and 20 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
|
||||
from granian.cli import cli as granian_cli
|
||||
from granian import Granian
|
||||
from granian.constants import Interfaces, Loops
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
|
@ -36,23 +37,13 @@ def start():
|
|||
os.environ["ADVENT22__PRODUCTION_MODE"] = "true"
|
||||
|
||||
settings = Settings()
|
||||
granian_cli(
|
||||
[
|
||||
"--host",
|
||||
settings.bind.host,
|
||||
"--port",
|
||||
settings.bind.port,
|
||||
"--workers",
|
||||
settings.workers.count,
|
||||
"--interface",
|
||||
"asgi",
|
||||
"--loop",
|
||||
"uvloop",
|
||||
"--process-name",
|
||||
"advent22",
|
||||
# app
|
||||
server = Granian(
|
||||
"advent22_api.app:app",
|
||||
],
|
||||
auto_envvar_prefix="GRANIAN",
|
||||
standalone_mode=False,
|
||||
address=settings.bind.host,
|
||||
port=settings.bind.port,
|
||||
workers=settings.workers.count,
|
||||
interface=Interfaces.ASGI,
|
||||
loop=Loops.uvloop,
|
||||
process_name="advent22",
|
||||
)
|
||||
server.serve()
|
||||
|
|
|
|||
Loading…
Reference in a new issue