mirror of
https://github.com/kossakovsky/n8n-install.git
synced 2026-03-07 06:13:05 +00:00
feat(n8n): add limit parameter to make import command
This commit is contained in:
@@ -77,6 +77,7 @@ make restart # Restart all services
|
||||
make show-restarts # Show restart count per container
|
||||
make doctor # Run system diagnostics (DNS, SSL, containers, disk, memory)
|
||||
make import # Import n8n workflows from backup
|
||||
make import n=10 # Import first N workflows only
|
||||
|
||||
make switch-beta # Switch to develop branch and update
|
||||
make switch-stable # Switch to main branch and update
|
||||
|
||||
5
Makefile
5
Makefile
@@ -19,6 +19,7 @@ help:
|
||||
@echo " make show-restarts Show restart count per container"
|
||||
@echo " make doctor Run system diagnostics"
|
||||
@echo " make import Import n8n workflows from backup"
|
||||
@echo " make import n=10 Import first N workflows only"
|
||||
@echo ""
|
||||
@echo " make switch-beta Switch to beta (develop branch)"
|
||||
@echo " make switch-stable Switch to stable (main branch)"
|
||||
@@ -78,4 +79,8 @@ switch-stable:
|
||||
sudo bash ./scripts/update.sh
|
||||
|
||||
import:
|
||||
ifdef n
|
||||
docker compose -p $(PROJECT_NAME) run --rm -e FORCE_IMPORT=true -e IMPORT_LIMIT=$(n) n8n-import
|
||||
else
|
||||
docker compose -p $(PROJECT_NAME) run --rm -e FORCE_IMPORT=true n8n-import
|
||||
endif
|
||||
|
||||
@@ -313,6 +313,7 @@ The project includes a Makefile for simplified command execution:
|
||||
| `make restart` | Restart all services |
|
||||
| `make show-restarts` | Show restart count per container |
|
||||
| `make import` | Import n8n workflows from backup |
|
||||
| `make import n=10` | Import first N workflows only |
|
||||
|
||||
### Diagnostics
|
||||
|
||||
|
||||
@@ -35,15 +35,12 @@ fi
|
||||
|
||||
TOTAL_FOUND=$(echo "$WORKFLOW_FILES" | wc -l | tr -d ' ')
|
||||
|
||||
# Apply limit if IMPORT_LIMIT is set
|
||||
if [ -n "$IMPORT_LIMIT" ] && [ "$IMPORT_LIMIT" -gt 0 ] 2>/dev/null; then
|
||||
# Apply limit if set (e.g., make import n=10)
|
||||
if [ -n "$IMPORT_LIMIT" ]; then
|
||||
WORKFLOW_FILES=$(echo "$WORKFLOW_FILES" | head -n "$IMPORT_LIMIT")
|
||||
TOTAL=$(echo "$WORKFLOW_FILES" | wc -l | tr -d ' ')
|
||||
echo "Found $TOTAL_FOUND workflows, importing first $TOTAL (limit: $IMPORT_LIMIT)"
|
||||
else
|
||||
TOTAL=$TOTAL_FOUND
|
||||
echo "Found $TOTAL workflows to import"
|
||||
fi
|
||||
TOTAL=$(echo "$WORKFLOW_FILES" | wc -l | tr -d ' ')
|
||||
echo "Importing $TOTAL of $TOTAL_FOUND workflows"
|
||||
echo ''
|
||||
|
||||
# Use a counter file since pipes create subshells
|
||||
|
||||
@@ -418,7 +418,7 @@
|
||||
{ cmd: 'make show-restarts', desc: 'Show restart count per container' },
|
||||
{ cmd: 'make doctor', desc: 'Run system diagnostics' },
|
||||
{ cmd: 'make update', desc: 'Update system and services' },
|
||||
{ cmd: 'make import', desc: 'Import n8n workflows from backup' },
|
||||
{ cmd: 'make import', desc: 'Import n8n workflows (use n=10 to limit)' },
|
||||
{ cmd: 'make clean', desc: 'Remove unused Docker resources' }
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user