File size: 1,047 Bytes
33261d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# Build public URL from the HF Space host (SPACE_HOST is set automatically by HF)
if [ -n "$SPACE_HOST" ]; then
  export N8N_HOST="$SPACE_HOST"
  export WEBHOOK_URL="https://$SPACE_HOST/"
  export N8N_EDITOR_BASE_URL="https://$SPACE_HOST/"
fi

# Map secrets -> n8n DB variables
export DB_POSTGRESDB_HOST="${DB_POSTGRESDB_HOST:-}"
export DB_POSTGRESDB_PORT="${DB_POSTGRESDB_PORT:-5432}"
export DB_POSTGRESDB_DATABASE="${DB_POSTGRESDB_DATABASE:-postgres}"
export DB_POSTGRESDB_USER="${DB_POSTGRESDB_USER:-postgres}"
export DB_POSTGRESDB_SSL_ENABLED="${DB_POSTGRESDB_SSL_ENABLED:-true}"
export DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED="${DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED:-false}"

# If no Postgres host given, fall back to SQLite (data is LOST on restart)
if [ -z "$DB_POSTGRESDB_HOST" ]; then
  echo "WARNING: No Postgres configured. Using SQLite - data will be lost on restart."
  export DB_TYPE=sqlite
fi

if [ -z "$N8N_ENCRYPTION_KEY" ]; then
  echo "WARNING: N8N_ENCRYPTION_KEY not set. Set it as a Space secret!"
fi

exec n8n start