[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
|
#!/usr/bin/env python3
|
||||||
__version__ = '0.6.2'
|
__version__ = '0.6.1'
|
||||||
|
|
||||||
def version():
|
def version():
|
||||||
return f'HalfAPI version:{__version__}'
|
return f'HalfAPI version:{__version__}'
|
||||||
|
@ -146,9 +146,17 @@ def domain(domain, delete, update, create, read): #, domains, read, create, upd
|
|||||||
if delete:
|
if delete:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
if read:
|
if read:
|
||||||
half_domain = HalfDomain(
|
from ..conf import CONFIG
|
||||||
domain,
|
from ..halfapi import HalfAPI
|
||||||
config=CONFIG.get('domain').get('domain_name', {}))
|
|
||||||
|
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(
|
click.echo(orjson.dumps(
|
||||||
half_domain.schema(),
|
half_domain.schema(),
|
||||||
|
@ -53,8 +53,10 @@ def run(host, port, reload, secret, production, loglevel, prefix, check, dryrun,
|
|||||||
|
|
||||||
if domain:
|
if domain:
|
||||||
# If we specify a domain to run as argument
|
# 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
|
# Disable all domains
|
||||||
CONFIG['domain'].pop(key)
|
CONFIG['domain'].pop(key)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user