mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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:
parent
5c2121b1a1
commit
75d5f9d6e6
@ -923,8 +923,7 @@ MARKDOWNIFY_BLEACH = False
|
|||||||
# Maintenance mode
|
# Maintenance mode
|
||||||
MAINTENANCE_MODE_RETRY_AFTER = 60
|
MAINTENANCE_MODE_RETRY_AFTER = 60
|
||||||
|
|
||||||
|
# Plugin Directories (local plugins will be loaded from these directories)
|
||||||
# Plugins
|
|
||||||
PLUGIN_DIRS = ['plugin.builtin', ]
|
PLUGIN_DIRS = ['plugin.builtin', ]
|
||||||
|
|
||||||
if not TESTING:
|
if not TESTING:
|
||||||
@ -935,6 +934,23 @@ if DEBUG or TESTING:
|
|||||||
# load samples in debug mode
|
# load samples in debug mode
|
||||||
PLUGIN_DIRS.append('plugin.samples')
|
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 test settings
|
||||||
PLUGIN_TESTING = get_setting('PLUGIN_TESTING', TESTING) # are plugins beeing tested?
|
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?
|
PLUGIN_TESTING_SETUP = get_setting('PLUGIN_TESTING_SETUP', False) # load plugins from setup hooks in testing?
|
||||||
|
@ -30,9 +30,11 @@ ENV INVENTREE_MNG_DIR="${INVENTREE_HOME}/InvenTree"
|
|||||||
ENV INVENTREE_DATA_DIR="${INVENTREE_HOME}/data"
|
ENV INVENTREE_DATA_DIR="${INVENTREE_HOME}/data"
|
||||||
ENV INVENTREE_STATIC_ROOT="${INVENTREE_DATA_DIR}/static"
|
ENV INVENTREE_STATIC_ROOT="${INVENTREE_DATA_DIR}/static"
|
||||||
ENV INVENTREE_MEDIA_ROOT="${INVENTREE_DATA_DIR}/media"
|
ENV INVENTREE_MEDIA_ROOT="${INVENTREE_DATA_DIR}/media"
|
||||||
|
ENV INVENTREE_PLUGIN_DIR="${INVENTREE_DATA_DIR}/plugins"
|
||||||
|
|
||||||
ENV INVENTREE_CONFIG_FILE="${INVENTREE_DATA_DIR}/config.yaml"
|
ENV INVENTREE_CONFIG_FILE="${INVENTREE_DATA_DIR}/config.yaml"
|
||||||
ENV INVENTREE_SECRET_KEY_FILE="${INVENTREE_DATA_DIR}/secret_key.txt"
|
ENV INVENTREE_SECRET_KEY_FILE="${INVENTREE_DATA_DIR}/secret_key.txt"
|
||||||
|
ENV INVENTREE_PLUGIN_FILE="${INVENTREE_DATA_DIR}}/plugins.txt"
|
||||||
|
|
||||||
# Worker configuration (can be altered by user)
|
# Worker configuration (can be altered by user)
|
||||||
ENV INVENTREE_GUNICORN_WORKERS="4"
|
ENV INVENTREE_GUNICORN_WORKERS="4"
|
||||||
|
Loading…
Reference in New Issue
Block a user