Update start.sh
Browse files
start.sh
CHANGED
|
@@ -8,22 +8,33 @@ if [ -n "$SPACE_HOST" ]; then
|
|
| 8 |
export WEBHOOK_URL="https://$(echo $SPACE_HOST)"
|
| 9 |
echo "INFO: n8n WEBHOOK_URL automatically set to $WEBHOOK_URL"
|
| 10 |
else
|
| 11 |
-
# This case should ideally not happen on a running Hugging Face Space.
|
| 12 |
-
# If running locally without SPACE_HOST, n8n might try to infer, or you can set it manually.
|
| 13 |
echo "WARNING: SPACE_HOST environment variable not set. WEBHOOK_URL may not be configured correctly for public access."
|
| 14 |
echo "INFO: n8n will attempt to infer the WEBHOOK_URL, or you can set it manually via environment variables."
|
| 15 |
fi
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
#
|
| 19 |
-
#
|
| 20 |
-
#
|
| 21 |
-
#
|
| 22 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
echo "INFO: Starting n8n..."
|
| 28 |
-
# Execute the
|
| 29 |
exec n8n
|
|
|
|
| 8 |
export WEBHOOK_URL="https://$(echo $SPACE_HOST)"
|
| 9 |
echo "INFO: n8n WEBHOOK_URL automatically set to $WEBHOOK_URL"
|
| 10 |
else
|
|
|
|
|
|
|
| 11 |
echo "WARNING: SPACE_HOST environment variable not set. WEBHOOK_URL may not be configured correctly for public access."
|
| 12 |
echo "INFO: n8n will attempt to infer the WEBHOOK_URL, or you can set it manually via environment variables."
|
| 13 |
fi
|
| 14 |
|
| 15 |
+
# --- IMPORTANT: Encryption Key ---
|
| 16 |
+
# N8N_ENCRYPTION_KEY is crucial for securing your credentials.
|
| 17 |
+
# If not set, n8n auto-generates one. If this auto-generated key changes (e.g., on pod restart
|
| 18 |
+
# without persistent storage for the key itself), your previously saved credentials will be unreadable.
|
| 19 |
+
#
|
| 20 |
+
# YOU MUST SET N8N_ENCRYPTION_KEY as a SECRET in your Hugging Face Space settings
|
| 21 |
+
# for any production or sensitive data use.
|
| 22 |
+
# Generate a strong, random string for this key. E.g., using: openssl rand -hex 32
|
| 23 |
+
if [ -z "$N8N_ENCRYPTION_KEY" ]; then
|
| 24 |
+
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
| 25 |
+
echo "!! WARNING: N8N_ENCRYPTION_KEY is NOT SET. n8n will auto-generate a temporary one. !!"
|
| 26 |
+
echo "!! This is INSECURE for production and may lead to DATA LOSS of credentials. !!"
|
| 27 |
+
echo "!! Please set N8N_ENCRYPTION_KEY as a Secret in your Space settings. !!"
|
| 28 |
+
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
| 29 |
+
fi
|
| 30 |
|
| 31 |
+
# Optional: Set other n8n environment variables here if needed,
|
| 32 |
+
# or preferably as Secrets in your Hugging Face Space settings.
|
| 33 |
+
# Example for basic authentication (use with caution, prefer SSO if possible):
|
| 34 |
+
# export N8N_BASIC_AUTH_ACTIVE=true
|
| 35 |
+
# export N8N_BASIC_AUTH_USER="your_username_secret"
|
| 36 |
+
# export N8N_BASIC_AUTH_PASSWORD="your_strong_password_secret"
|
| 37 |
|
| 38 |
echo "INFO: Starting n8n..."
|
| 39 |
+
# Execute the main n8n command. It will pick up all N8N_* environment variables.
|
| 40 |
exec n8n
|