RJuro commited on
Commit
bb03dac
·
verified ·
1 Parent(s): d680316

Create start.sh

Browse files
Files changed (1) hide show
  1. start.sh +29 -0
start.sh ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ # Hugging Face Spaces provides SPACE_HOST as an environment variable
4
+ # (e.g., your-username-your-space-name.hf.space).
5
+ # We must set WEBHOOK_URL for n8n to correctly generate public URLs for webhooks.
6
+ if [ -n "$SPACE_HOST" ]; then
7
+ # Ensure the URL scheme is https as HF Spaces are served over HTTPS
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
+ # Optional: Set other n8n environment variables here if needed.
18
+ # These can also be set as Secrets in your Hugging Face Space settings for sensitive data.
19
+ # Example for basic authentication (less secure than SSO, use with caution):
20
+ # export N8N_BASIC_AUTH_ACTIVE=true
21
+ # export N8N_BASIC_AUTH_USER="your_username" # Change this
22
+ # export N8N_BASIC_AUTH_PASSWORD="your_strong_password" # Change this & use secrets
23
+
24
+ # Example for setting a custom encryption key (IMPORTANT for security, generate a strong random string)
25
+ # export N8N_ENCRYPTION_KEY="your_very_strong_random_encryption_key_here" # Use secrets for this
26
+
27
+ echo "INFO: Starting n8n..."
28
+ # Execute the default n8n command. n8n will pick up all N8N_* environment variables.
29
+ exec n8n