[conf] remove is_project variable

This commit is contained in:
Maxime Alves LIRMM 2021-11-23 11:39:33 +01:00
parent ea8e7ede65
commit f0e662e060
2 changed files with 4 additions and 22 deletions

View File

@ -8,12 +8,6 @@ not loaded otherwise.
# builtins
import click
IS_PROJECT = True
try:
from ..conf import DOMAINS
except Exception:
IS_PROJECT = False
@click.group(invoke_without_command=True)
@click.option('--version', is_flag=True)
@click.pass_context
@ -27,12 +21,8 @@ def cli(ctx, version):
from halfapi import version
click.echo(version())
if IS_PROJECT:
from . import config
from . import domain
from . import run
else:
from . import init
from . import config
from . import domain
from . import run
from . import init
from . import routes

View File

@ -17,7 +17,6 @@ It defines the following globals :
- HOST (str) - HALFAPI_HOST
- PORT (int) - HALFAPI_PORT
- CONF_DIR (str) - HALFAPI_CONF_DIR
- IS_PROJECT (bool)
- config (ConfigParser)
It reads the following ressource :
@ -55,11 +54,6 @@ PORT = '3000'
SECRET = ''
CONF_FILE = os.environ.get('HALFAPI_CONF_FILE', '.halfapi/config')
is_project = lambda: os.path.isfile(CONF_FILE)
config = ConfigParser(allow_no_value=True)
CONF_DIR = environ.get('HALFAPI_CONF_DIR', '/etc/half_api')
@ -108,8 +102,6 @@ def read_config():
CONFIG = {}
read_config()
IS_PROJECT = True
PROJECT_NAME = config.get('project', 'name', fallback=PROJECT_NAME)
if len(PROJECT_NAME) == 0: