23 lines
549 B
Bash
23 lines
549 B
Bash
#!/bin/sh
|
|
|
|
# Replace API host in built JavaScript files
|
|
echo "Replacing SECRET_HOST with ${API_HOST}"
|
|
|
|
# Replace in main JS files
|
|
for i in /usr/share/nginx/html/*.js; do
|
|
if [ -f "$i" ]; then
|
|
sed -i "s|SECRET_HOST|${API_HOST}|g" "$i"
|
|
fi
|
|
done
|
|
|
|
# Replace in assets folder JS files
|
|
for i in /usr/share/nginx/html/assets/*.js; do
|
|
if [ -f "$i" ]; then
|
|
sed -i "s|SECRET_HOST|${API_HOST}|g" "$i"
|
|
fi
|
|
done
|
|
|
|
echo "Replacement completed. Starting nginx..."
|
|
|
|
# Start nginx and replace the shell process
|
|
exec nginx -g 'daemon off;' |