blob: 55e2b6c7f867b6ef2e0c75d55d20a524a1396d6e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/bin/sh
set -e
# If HOST is set, replace /static/ URLs in CSS and JS files
if [ ! -z "$HOST" ]; then
# Escape special characters for sed
ESCAPED_HOST=$(echo "$HOST" | sed 's/[\/&]/\\&/g')
# Replace /static/ paths in all CSS files
find /usr/share/nginx/html -name "*.css" -type f -exec sed -i "s|/static/|${ESCAPED_HOST}/static/|g" {} \;
# Replace /static/ paths in all JS files
find /usr/share/nginx/html -name "*.js" -type f -exec sed -i "s|/static/|${ESCAPED_HOST}/static/|g" {} \;
echo "✓ Updated static URLs to use HOST: $HOST"
else
echo "✓ Serving static assets from /static/ (local, no HOST set)"
fi
# Start nginx in foreground
exec nginx -g "daemon off;"
|