Spaces:
Runtime error
Runtime error
| set -e | |
| # 添加错误处理 | |
| trap 'echo "Error on line $LINENO"' ERR | |
| # 环境变量检查 | |
| : "${N8N_ENCRYPTION_KEY:?Need to set N8N_ENCRYPTION_KEY}" | |
| WEBDAV_URL="$WEBDAV_URL" | |
| WEBDAV_USER="$WEBDAV_USER" | |
| WEBDAV_PASSWORD="$WEBDAV_PASSWORD" | |
| current_time=$(date +"%Y-%m-%d %H:%M:%S") | |
| echo "Starting n8n at $current_time" | |
| # 设置 N8N 环境变量 | |
| export N8N_ENCRYPTION_KEY="n8n8n8n" | |
| # 允许使用所有内建模块 | |
| export NODE_FUNCTION_ALLOW_BUILTIN=* | |
| # 允许使用外部 npm 模块 | |
| export NODE_FUNCTION_ALLOW_EXTERNAL=* | |
| # Activate automatic data pruning | |
| export EXECUTIONS_DATA_PRUNE=true | |
| # Number of hours after execution that n8n deletes data | |
| export EXECUTIONS_DATA_MAX_AGE=36 | |
| # Number of executions to store | |
| export EXECUTIONS_DATA_PRUNE_MAX_COUNT=1000 | |
| # Save executions ending in errors | |
| export EXECUTIONS_DATA_SAVE_ON_ERROR=all | |
| # Save successful executions | |
| export EXECUTIONS_DATA_SAVE_ON_SUCCESS=all | |
| # Don't save node progress for each execution | |
| export EXECUTIONS_DATA_SAVE_ON_PROGRESS=false | |
| # Don't save manually launched executions | |
| export EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=false | |
| # 使用绝对路径调用 n8n,添加日志输出 | |
| exec n8n start | |