mirror of
https://github.com/stan-smith/FossFLOW.git
synced 2026-06-11 17:04:14 -04:00
* feat(docker): add HTTP Basic Authentication support * fix: address review feedback * Update docker-entrypoint.sh * Update .env.example Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: use bcrypt for htpasswd and ensure .htpasswd file always exists --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
27 lines
894 B
Bash
27 lines
894 B
Bash
#!/bin/sh
|
|
|
|
# Start Node.js backend if server storage is enabled
|
|
if [ "$ENABLE_SERVER_STORAGE" = "true" ]; then
|
|
echo "Starting FossFLOW backend server..."
|
|
cd /app/packages/fossflow-backend
|
|
npm install --production
|
|
node server.js &
|
|
echo "Backend server started"
|
|
else
|
|
echo "Server storage disabled, backend not started"
|
|
fi
|
|
|
|
# Start nginx
|
|
|
|
# Configure HTTP Basic Auth
|
|
touch /etc/nginx/.htpasswd
|
|
if [ -n "$HTTP_AUTH_USER" ] && [ -n "$HTTP_AUTH_PASSWORD" ]; then
|
|
echo "Setup HTTP Basic Auth..."
|
|
echo "$HTTP_AUTH_USER:$(printf '%s' "$HTTP_AUTH_PASSWORD" | openssl passwd -bcrypt -stdin)" > /etc/nginx/.htpasswd
|
|
sed -i 's/AUTH_BASIC_SETTING/"Restricted"/g' /etc/nginx/http.d/default.conf
|
|
else
|
|
echo "No (optional) HTTP Basic Auth configured"
|
|
sed -i 's/AUTH_BASIC_SETTING/off/g' /etc/nginx/http.d/default.conf
|
|
fi
|
|
echo "Starting nginx..."
|
|
nginx -g "daemon off;" |