2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-16 12:05:53 +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 | | Name | Description | Default | Units |
| ---- | ----------- | ------- | ----- | | ---- | ----------- | ------- | ----- |
{{ globalsetting("PLUGIN_ON_STARTUP") }}
{{ globalsetting("PLUGIN_UPDATE_CHECK") }} {{ globalsetting("PLUGIN_UPDATE_CHECK") }}
{{ globalsetting("ENABLE_PLUGINS_URL") }} {{ globalsetting("ENABLE_PLUGINS_URL") }}
{{ globalsetting("ENABLE_PLUGINS_NAVIGATION") }} {{ globalsetting("ENABLE_PLUGINS_NAVIGATION") }}

View File

@ -2110,6 +2110,16 @@ class InvenTreeSetting(BaseInvenTreeSetting):
'default': False, 'default': False,
'validator': bool, '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': { 'PLUGIN_UPDATE_CHECK': {
'name': _('Check for plugin updates'), 'name': _('Check for plugin updates'),
'description': _('Enable periodic checks for updates to installed plugins'), 'description': _('Enable periodic checks for updates to installed plugins'),

View File

@ -34,6 +34,18 @@ class PluginAppConfig(AppConfig):
logger.info('Loading InvenTree plugins') logger.info('Loading InvenTree plugins')
if not registry.is_loading: 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 # Perform a full reload of the plugin registry
registry.reload_plugins( registry.reload_plugins(
full_reload=True, force_reload=True, collect=True 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)) logger.warning('Plugin file %s does not exist', str(pf))
return return
cmd = ['install', '-U', '-r', str(pf)] cmd = ['install', '--disable-pip-version-check', '-U', '-r', str(pf)]
try: try:
pip_command(*cmd) pip_command(*cmd)