mirror of
https://github.com/inventree/InvenTree.git
synced 2026-01-28 17:13:44 +00:00
Improved handling for non-git-repo in docker mode (#11187)
- Handle error condition caused by loading order of operations
This commit is contained in:
@@ -83,6 +83,9 @@ config.load_version_file()
|
|||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = get_boolean_setting('INVENTREE_DEBUG', 'debug', False)
|
DEBUG = get_boolean_setting('INVENTREE_DEBUG', 'debug', False)
|
||||||
|
|
||||||
|
# Internal flag to determine if we are running in docker mode
|
||||||
|
DOCKER = get_boolean_setting('INVENTREE_DOCKER', default_value=False)
|
||||||
|
|
||||||
# Configure logging settings
|
# Configure logging settings
|
||||||
LOG_LEVEL = get_setting('INVENTREE_LOG_LEVEL', 'log_level', 'WARNING')
|
LOG_LEVEL = get_setting('INVENTREE_LOG_LEVEL', 'log_level', 'WARNING')
|
||||||
JSON_LOG = get_boolean_setting('INVENTREE_JSON_LOG', 'json_log', False)
|
JSON_LOG = get_boolean_setting('INVENTREE_JSON_LOG', 'json_log', False)
|
||||||
@@ -544,9 +547,6 @@ if LDAP_AUTH: # pragma: no cover
|
|||||||
)
|
)
|
||||||
AUTH_LDAP_FIND_GROUP_PERMS = True
|
AUTH_LDAP_FIND_GROUP_PERMS = True
|
||||||
|
|
||||||
# Internal flag to determine if we are running in docker mode
|
|
||||||
DOCKER = get_boolean_setting('INVENTREE_DOCKER', default_value=False)
|
|
||||||
|
|
||||||
# Allow secure http developer server in debug mode
|
# Allow secure http developer server in debug mode
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
INSTALLED_APPS.append('sslserver')
|
INSTALLED_APPS.append('sslserver')
|
||||||
|
|||||||
@@ -36,11 +36,17 @@ try:
|
|||||||
main_repo = Repo(pathlib.Path(__file__).parent.parent.parent.parent.parent)
|
main_repo = Repo(pathlib.Path(__file__).parent.parent.parent.parent.parent)
|
||||||
main_commit = main_repo[main_repo.head()]
|
main_commit = main_repo[main_repo.head()]
|
||||||
except NotGitRepository:
|
except NotGitRepository:
|
||||||
# If we are running in a docker container, the repo may not be available, only logging as warning if not in docker
|
output = logger.warning
|
||||||
|
|
||||||
|
try:
|
||||||
if settings.DOCKER:
|
if settings.DOCKER:
|
||||||
logger.info(git_warning_txt)
|
output = logger.info
|
||||||
else:
|
except Exception:
|
||||||
logger.warning(git_warning_txt)
|
# We may not have access to settings at this point
|
||||||
|
pass
|
||||||
|
|
||||||
|
output(git_warning_txt)
|
||||||
|
|
||||||
main_repo = None
|
main_repo = None
|
||||||
main_commit = None
|
main_commit = None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user