mirror of
https://github.com/inventree/InvenTree.git
synced 2026-01-28 09:03:41 +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!
|
||||
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
|
||||
LOG_LEVEL = get_setting('INVENTREE_LOG_LEVEL', 'log_level', 'WARNING')
|
||||
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
|
||||
|
||||
# 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
|
||||
if DEBUG:
|
||||
INSTALLED_APPS.append('sslserver')
|
||||
|
||||
@@ -36,11 +36,17 @@ try:
|
||||
main_repo = Repo(pathlib.Path(__file__).parent.parent.parent.parent.parent)
|
||||
main_commit = main_repo[main_repo.head()]
|
||||
except NotGitRepository:
|
||||
# If we are running in a docker container, the repo may not be available, only logging as warning if not in docker
|
||||
if settings.DOCKER:
|
||||
logger.info(git_warning_txt)
|
||||
else:
|
||||
logger.warning(git_warning_txt)
|
||||
output = logger.warning
|
||||
|
||||
try:
|
||||
if settings.DOCKER:
|
||||
output = logger.info
|
||||
except Exception:
|
||||
# We may not have access to settings at this point
|
||||
pass
|
||||
|
||||
output(git_warning_txt)
|
||||
|
||||
main_repo = None
|
||||
main_commit = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user