mirror of
https://github.com/fusion44/blitz_api.git
synced 2026-08-13 11:52:45 +02:00
- formatting - small fix in a bitcoind model - update the fake blitz scripts - remove some dead code (app status sub)
33 lines
822 B
Python
33 lines
822 B
Python
import uvicorn
|
|
|
|
from app.api.config import config
|
|
|
|
import click # isort:skip
|
|
|
|
|
|
@click.command()
|
|
@click.option("--port", default="5000", help="Port to run Blitz API on")
|
|
@click.option("--host", default="127.0.0.1", help="Host to run Blitz API on")
|
|
@click.option(
|
|
"--root_path",
|
|
default=None,
|
|
help="Set the ASGI 'root_path' for applications submounted below a given URL path.",
|
|
)
|
|
def main(port, host, root_path):
|
|
"""Launched with `poetry run api` at root level"""
|
|
|
|
p = ""
|
|
if root_path is not None and root_path != "":
|
|
p = root_path
|
|
else:
|
|
p = str(config("BAPI_ROOT_PATH", default=""))
|
|
|
|
if p == "/":
|
|
root_path = ""
|
|
|
|
print(f"launching with {host}:{port}{p}")
|
|
uvicorn.run("app.main:app", port=port, host=host, root_path=p)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|