docker-mode switch in settings and tags

This commit is contained in:
Matthias 2021-05-16 18:19:35 +02:00
parent 16b7d6c34d
commit b2a912c770
3 changed files with 13 additions and 0 deletions

View File

@ -87,6 +87,11 @@ DEBUG = _is_true(get_setting(
CONFIG.get('debug', True) CONFIG.get('debug', True)
)) ))
DOCKER = _is_true(get_setting(
'INVENTREE_DOCKER',
False
))
# Configure logging settings # Configure logging settings
log_level = get_setting( log_level = get_setting(
'INVENTREE_LOG_LEVEL', 'INVENTREE_LOG_LEVEL',

View File

@ -81,6 +81,13 @@ def inventree_in_debug_mode(*args, **kwargs):
return djangosettings.DEBUG return djangosettings.DEBUG
@register.simple_tag()
def inventree_docker_mode(*args, **kwargs):
""" Return True if the server is running as a Docker image """
return djangosettings.DOCKER
@register.simple_tag() @register.simple_tag()
def inventree_db_engine(*args, **kwargs): def inventree_db_engine(*args, **kwargs):
""" Return the InvenTree database backend e.g. 'postgresql' """ """ Return the InvenTree database backend e.g. 'postgresql' """

View File

@ -14,6 +14,7 @@ ENV INVENTREE_REPO="${repository}"
ENV INVENTREE_BRANCH="${branch}" ENV INVENTREE_BRANCH="${branch}"
ENV INVENTREE_LOG_LEVEL="INFO" ENV INVENTREE_LOG_LEVEL="INFO"
ENV INVENTREE_DOCKER="true"
# InvenTree paths # InvenTree paths
ENV INVENTREE_SRC_DIR="${INVENTREE_HOME}/src" ENV INVENTREE_SRC_DIR="${INVENTREE_HOME}/src"