mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-19 13:35:40 +00:00
Allow specification of an external plugin directory
- Specify directory using INVENTREE_PLUGIN_DIR - Specify installation file using INVENTREE_PLUGIN_FILE
This commit is contained in:
@ -923,8 +923,7 @@ MARKDOWNIFY_BLEACH = False
|
||||
# Maintenance mode
|
||||
MAINTENANCE_MODE_RETRY_AFTER = 60
|
||||
|
||||
|
||||
# Plugins
|
||||
# Plugin Directories (local plugins will be loaded from these directories)
|
||||
PLUGIN_DIRS = ['plugin.builtin', ]
|
||||
|
||||
if not TESTING:
|
||||
@ -935,6 +934,23 @@ if DEBUG or TESTING:
|
||||
# load samples in debug mode
|
||||
PLUGIN_DIRS.append('plugin.samples')
|
||||
|
||||
# Check if an external plugin directory has been specified as an environment variable
|
||||
# Note: This should be specified as INVENTREE_PLUGIN_DIR
|
||||
plugin_dir = os.getenv('INVENTREE_PLUGIN_DIR')
|
||||
|
||||
if plugin_dir:
|
||||
if not os.path.exists(plugin_dir):
|
||||
logger.info(f"Plugin directory '{plugin_dir}' does not exist")
|
||||
|
||||
try:
|
||||
os.makedirs(plugin_dir, exist_ok=True)
|
||||
logger.info(f"Created plugin directory '{plugin_dir}'")
|
||||
except:
|
||||
logger.warning(f"Could not create plugins directory '{plugin_dir}'")
|
||||
|
||||
if os.path.exists(plugin_dir):
|
||||
PLUGIN_DIRS.append(plugin_dir)
|
||||
|
||||
# Plugin test settings
|
||||
PLUGIN_TESTING = get_setting('PLUGIN_TESTING', TESTING) # are plugins beeing tested?
|
||||
PLUGIN_TESTING_SETUP = get_setting('PLUGIN_TESTING_SETUP', False) # load plugins from setup hooks in testing?
|
||||
|
Reference in New Issue
Block a user