diff --git a/halfapi/conf.py b/halfapi/conf.py index a2a496f..92c0a08 100644 --- a/halfapi/conf.py +++ b/halfapi/conf.py @@ -48,7 +48,7 @@ from .logging import logger PROJECT_NAME = environ.get('HALFAPI_PROJECT_NAME') or os.path.basename(os.getcwd()) DOMAINSDICT = lambda: {} DOMAINS = {} -PRODUCTION = False +PRODUCTION = True LOGLEVEL = 'info' HOST = '127.0.0.1' PORT = '3000' @@ -133,7 +133,7 @@ except FileNotFoundError as exc: logger.error('Missing secret file: %s', exc) PRODUCTION = config.getboolean('project', 'production', - fallback=environ.get('HALFAPI_PROD', False)) + fallback=environ.get('HALFAPI_PROD', True)) LOGLEVEL = config.get('project', 'loglevel', fallback=environ.get('HALFAPI_LOGLEVEL', 'info')).lower() diff --git a/tests/test_conf.py b/tests/test_conf.py new file mode 100644 index 0000000..befcc12 --- /dev/null +++ b/tests/test_conf.py @@ -0,0 +1,22 @@ +from halfapi.halfapi import HalfAPI + +def test_conf_production_default(): + halfapi = HalfAPI({ + 'DOMAINS': {'test': True} + }) + assert halfapi.PRODUCTION is True + +def test_conf_production_true(): + halfapi = HalfAPI({ + 'PRODUCTION': True, + 'DOMAINS': {'test': True} + }) + assert halfapi.PRODUCTION is True + +def test_conf_production_false(): + halfapi = HalfAPI({ + 'PRODUCTION': False, + 'DOMAINS': {'test': True} + }) + assert halfapi.PRODUCTION is False +