[cli] .halfapi/domains.
This commit is contained in:
parent
15a63f3713
commit
ceaf2774bf
|
@ -14,7 +14,6 @@ from halfapi import __version__
|
||||||
from halfapi.cli.lib.db import ProjectDB
|
from halfapi.cli.lib.db import ProjectDB
|
||||||
|
|
||||||
CONTEXT_SETTINGS = {
|
CONTEXT_SETTINGS = {
|
||||||
'default_map':{'run': {}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TMPL_HALFAPI_ETC = """Insert this into the HALFAPI_CONF_DIR/{project} file
|
TMPL_HALFAPI_ETC = """Insert this into the HALFAPI_CONF_DIR/{project} file
|
||||||
|
@ -66,7 +65,6 @@ def run(host, port):
|
||||||
click.echo('Launching application')
|
click.echo('Launching application')
|
||||||
|
|
||||||
sys.path.insert(0, BASE_DIR)
|
sys.path.insert(0, BASE_DIR)
|
||||||
click.echo(f'current python_path : {sys.path}')
|
|
||||||
|
|
||||||
uvicorn.run('halfapi.app:application',
|
uvicorn.run('halfapi.app:application',
|
||||||
host=host,
|
host=host,
|
||||||
|
@ -367,7 +365,7 @@ def init_project(project, repo):
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
os.mkdir(os.path.join(project, '.halfapi'))
|
os.mkdir(os.path.join(project, '.halfapi'))
|
||||||
open(os.path.join(project, '.halfapi', 'domains'), 'w').write('')
|
open(os.path.join(project, '.halfapi', 'domains'), 'w').write('[domains]\n')
|
||||||
config_file = os.path.join(project, '.halfapi', 'config')
|
config_file = os.path.join(project, '.halfapi', 'config')
|
||||||
with open(config_file, 'w') as f:
|
with open(config_file, 'w') as f:
|
||||||
f.write(TMPL_HALFAPI_CONFIG.format(
|
f.write(TMPL_HALFAPI_CONFIG.format(
|
||||||
|
|
|
@ -16,7 +16,7 @@ default_config = {
|
||||||
|
|
||||||
config = ConfigParser(allow_no_value=True)
|
config = ConfigParser(allow_no_value=True)
|
||||||
config.read_dict(default_config)
|
config.read_dict(default_config)
|
||||||
config.read(filenames=['.halfapiconfig'])
|
config.read(filenames=['.halfapi/config'])
|
||||||
|
|
||||||
PROJECT_NAME = config.get('project', 'name')
|
PROJECT_NAME = config.get('project', 'name')
|
||||||
|
|
||||||
|
@ -24,6 +24,12 @@ if len(PROJECT_NAME) == 0:
|
||||||
raise Exception('Need a project name as argument')
|
raise Exception('Need a project name as argument')
|
||||||
|
|
||||||
|
|
||||||
|
config = ConfigParser(allow_no_value=True)
|
||||||
|
config.read_dict(default_config)
|
||||||
|
config.read(filenames=['.halfapi/domains'])
|
||||||
|
|
||||||
|
DOMAINS = [domain for domain, _ in config.items('domains')]
|
||||||
|
|
||||||
CONF_DIR = environ.get('HALFAPI_CONF_DIR', '/etc/half_api')
|
CONF_DIR = environ.get('HALFAPI_CONF_DIR', '/etc/half_api')
|
||||||
|
|
||||||
config.read(filenames=[os.path.join(
|
config.read(filenames=[os.path.join(
|
||||||
|
@ -40,5 +46,3 @@ with open(config.get('project', 'secret')) as secret_file:
|
||||||
|
|
||||||
PRODUCTION = config.getboolean('project', 'production')
|
PRODUCTION = config.getboolean('project', 'production')
|
||||||
BASE_DIR = config.get('project', 'base_dir')
|
BASE_DIR = config.get('project', 'base_dir')
|
||||||
|
|
||||||
DOMAINS = [domain for domain, _ in config.items('domains')]
|
|
||||||
|
|
Loading…
Reference in New Issue