create infinite

This commit is contained in:
Waylon Walker 2024-04-05 20:13:47 -05:00
parent 54b3c4bc9b
commit 7bff037b78
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
14 changed files with 419 additions and 4 deletions

44
htmx_patterns/cli/api.py Normal file
View file

@ -0,0 +1,44 @@
import typer
import uvicorn
from rich.console import Console
from htmx_patterns.config import get_config
api_app = typer.Typer()
@api_app.callback()
def api():
"model cli"
@api_app.command()
def config(
env: str = typer.Option(
"local",
help="the environment to use",
),
):
config = get_config(env)
Console().print(config)
@api_app.command()
def run(
env: str = typer.Option(
"local",
help="the environment to use",
),
alembic_revision: str = typer.Option(
"head",
help="the alembic revision to use",
),
):
config = get_config(env)
Console().print(config.api_server)
uvicorn.run(**config.api_server.dict())
if __name__ == "__main__":
api_app()