[cli.run] halfapi run SCHEMA.csv
This commit is contained in:
parent
189fcf86f7
commit
b3b32b47f8
|
@ -12,6 +12,7 @@ from .domain import list_api_routes
|
|||
from ..conf import (PROJECT_NAME, HOST, PORT, SCHEMA,
|
||||
PRODUCTION, LOGLEVEL, DOMAINSDICT, CONFIG)
|
||||
from ..logging import logger
|
||||
from ..lib.schemas import schema_csv_dict
|
||||
|
||||
@click.option('--host', default=HOST)
|
||||
@click.option('--port', default=PORT)
|
||||
|
@ -20,9 +21,10 @@ from ..logging import logger
|
|||
@click.option('--production', default=True)
|
||||
@click.option('--loglevel', default=LOGLEVEL)
|
||||
@click.option('--prefix', default='')
|
||||
@click.option('--check', default=True)
|
||||
@click.argument('schema', type=click.File('r'), required=False)
|
||||
@cli.command()
|
||||
def run(host, port, reload, secret, production, loglevel, prefix, schema):
|
||||
def run(host, port, reload, secret, production, loglevel, prefix, check, schema):
|
||||
"""
|
||||
The "halfapi run" command
|
||||
"""
|
||||
|
@ -48,7 +50,12 @@ def run(host, port, reload, secret, production, loglevel, prefix, schema):
|
|||
|
||||
sys.path.insert(0, os.getcwd())
|
||||
|
||||
list_api_routes()
|
||||
if schema:
|
||||
# Populate the SCHEMA global with the data from the given file
|
||||
for key, val in schema_csv_dict(schema).items():
|
||||
SCHEMA[key] = val
|
||||
|
||||
# list_api_routes()
|
||||
|
||||
click.echo(f'uvicorn.run("halfapi.app:application"\n' \
|
||||
f'host: {host}\n' \
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
from halfapi.halfapi import HalfAPI
|
||||
|
||||
def test_methods():
|
||||
assert 'application' in dir(HalfAPI)
|
||||
assert 'routes' in dir(HalfAPI)
|
||||
assert 'version' in dir(HalfAPI)
|
||||
assert 'version_async' in dir(HalfAPI)
|
Loading…
Reference in New Issue