[cli] Print routes when running application.

This commit is contained in:
Joël Maïzi 2020-08-05 10:34:54 +02:00
parent ceaf2774bf
commit 7f0e2d0a07
1 changed files with 8 additions and 9 deletions

View File

@ -12,6 +12,13 @@ from configparser import ConfigParser
from halfapi import __version__ from halfapi import __version__
from halfapi.cli.lib.db import ProjectDB from halfapi.cli.lib.db import ProjectDB
from halfapi.conf import DOMAINS
from halfapi.db import (
Domain,
APIRouter,
APIRoute,
AclFunction,
Acl)
CONTEXT_SETTINGS = { CONTEXT_SETTINGS = {
} }
@ -65,6 +72,7 @@ def run(host, port):
click.echo('Launching application') click.echo('Launching application')
sys.path.insert(0, BASE_DIR) sys.path.insert(0, BASE_DIR)
list_routes(DOMAINS)
uvicorn.run('halfapi.app:application', uvicorn.run('halfapi.app:application',
host=host, host=host,
@ -97,16 +105,7 @@ def routes(domain, update):
update (boolean): If set, update the database for the selected domains update (boolean): If set, update the database for the selected domains
""" """
from halfapi.db import (
Domain,
APIRouter,
APIRoute,
AclFunction,
Acl)
global Domain, APIRouter, APIRoute, AclFunction, Acl
from halfapi.conf import DOMAINS
if not domain: if not domain:
domain = DOMAINS domain = DOMAINS
else: else: