[cli/domain] now instantiate HalfAPI and manually add the domain before calling schema function
This commit is contained in:
parent
f82cd5552b
commit
e9bf94a607
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
__version__ = '0.6.2'
|
||||
__version__ = '0.6.1'
|
||||
|
||||
def version():
|
||||
return f'HalfAPI version:{__version__}'
|
||||
|
|
|
@ -146,9 +146,17 @@ def domain(domain, delete, update, create, read): #, domains, read, create, upd
|
|||
if delete:
|
||||
raise NotImplementedError
|
||||
if read:
|
||||
half_domain = HalfDomain(
|
||||
domain,
|
||||
config=CONFIG.get('domain').get('domain_name', {}))
|
||||
from ..conf import CONFIG
|
||||
from ..halfapi import HalfAPI
|
||||
|
||||
try:
|
||||
config_domain = CONFIG.pop('domain').get(domain, {})
|
||||
except KeyError:
|
||||
config_domain = {}
|
||||
|
||||
halfapi = HalfAPI(CONFIG)
|
||||
|
||||
half_domain = halfapi.add_domain(domain, config=config_domain)
|
||||
|
||||
click.echo(orjson.dumps(
|
||||
half_domain.schema(),
|
||||
|
|
|
@ -53,8 +53,10 @@ def run(host, port, reload, secret, production, loglevel, prefix, check, dryrun,
|
|||
|
||||
if domain:
|
||||
# If we specify a domain to run as argument
|
||||
if 'domain' not in CONFIG:
|
||||
CONFIG['domain'] = {}
|
||||
|
||||
for key in CONFIG['domain']:
|
||||
for key in CONFIG.get('domain'):
|
||||
# Disable all domains
|
||||
CONFIG['domain'].pop(key)
|
||||
|
||||
|
|
Loading…
Reference in New Issue