2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 03:25:42 +00:00

Revert check on startup

This commit is contained in:
Oliver Walters
2024-11-18 09:18:38 +00:00
parent 57de67e837
commit 76cd6e019b
4 changed files with 24 additions and 1 deletions

View File

@ -210,6 +210,7 @@ Refer to the [return order settings](../order/return_order.md#return-order-setti
| Name | Description | Default | Units |
| ---- | ----------- | ------- | ----- |
{{ globalsetting("PLUGIN_ON_STARTUP") }}
{{ globalsetting("PLUGIN_UPDATE_CHECK") }}
{{ globalsetting("ENABLE_PLUGINS_URL") }}
{{ globalsetting("ENABLE_PLUGINS_NAVIGATION") }}

View File

@ -2110,6 +2110,16 @@ class InvenTreeSetting(BaseInvenTreeSetting):
'default': False,
'validator': bool,
},
'PLUGIN_ON_STARTUP': {
'name': _('Check plugins on startup'),
'description': _(
'Check that all plugins are installed on startup - enable in container environments'
),
'default': str(os.getenv('INVENTREE_DOCKER', 'False')).lower()
in ['1', 'true'],
'validator': bool,
'requires_restart': True,
},
'PLUGIN_UPDATE_CHECK': {
'name': _('Check for plugin updates'),
'description': _('Enable periodic checks for updates to installed plugins'),

View File

@ -34,6 +34,18 @@ class PluginAppConfig(AppConfig):
logger.info('Loading InvenTree plugins')
if not registry.is_loading:
# this is the first startup
try:
from common.models import InvenTreeSetting
if InvenTreeSetting.get_setting(
'PLUGIN_ON_STARTUP', create=False, cache=False
):
# make sure all plugins are installed
registry.install_plugin_file()
except Exception: # pragma: no cover
pass
# Perform a full reload of the plugin registry
registry.reload_plugins(
full_reload=True, force_reload=True, collect=True

View File

@ -113,7 +113,7 @@ def install_plugins_file():
logger.warning('Plugin file %s does not exist', str(pf))
return
cmd = ['install', '-U', '-r', str(pf)]
cmd = ['install', '--disable-pip-version-check', '-U', '-r', str(pf)]
try:
pip_command(*cmd)