mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-02-17 16:07:40 +01:00
This commit includes comprehensive codebase cleanup and refactoring: ## Code Cleanup - Remove dead TypeScript code (types/monitoring.ts - 194 lines duplicate) - Remove unused Go functions (GetClusterNodes, MigratePassword, GetClusterHealthInfo) - Clean up commented-out code blocks across multiple files - Remove unused TypeScript exports (helpTextClass, private tag color helpers) - Delete obsolete test files and components ## localStorage Consolidation - Centralize all storage keys into STORAGE_KEYS constant - Update 5 files to use centralized keys: * utils/apiClient.ts (AUTH, LEGACY_TOKEN) * components/Dashboard/Dashboard.tsx (GUEST_METADATA) * components/Docker/DockerHosts.tsx (DOCKER_METADATA) * App.tsx (PLATFORMS_SEEN) * stores/updates.ts (UPDATES) - Benefits: Single source of truth, prevents typos, better maintainability ## Previous Work Committed - Docker monitoring improvements and disk metrics - Security enhancements and setup fixes - API refactoring and cleanup - Documentation updates - Build system improvements ## Testing - All frontend tests pass (29 tests) - All Go tests pass (15 packages) - Production build successful - Zero breaking changes Total: 186 files changed, 5825 insertions(+), 11602 deletions(-)
44 lines
1.3 KiB
Bash
Executable File
44 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
# Default UID/GID if not provided
|
|
PUID=${PUID:-1000}
|
|
PGID=${PGID:-1000}
|
|
|
|
# Only adjust permissions if running as root
|
|
if [ "$(id -u)" = "0" ]; then
|
|
echo "Starting with UID: $PUID, GID: $PGID"
|
|
|
|
# If PUID is 0 (root), don't create a new user, just run as root
|
|
if [ "$PUID" = "0" ]; then
|
|
echo "Running as root user"
|
|
# Fix ownership to root
|
|
chown -R root:root /data /app /etc/pulse /opt/pulse
|
|
exec "$@"
|
|
fi
|
|
|
|
# Check if we need to modify the user/group
|
|
current_uid=$(id -u pulse 2>/dev/null || echo "")
|
|
current_gid=$(getent group pulse 2>/dev/null | cut -d: -f3 || echo "")
|
|
|
|
# If user/group don't match, recreate them
|
|
if [ "$current_uid" != "$PUID" ] || [ "$current_gid" != "$PGID" ]; then
|
|
# Remove existing user and group
|
|
deluser pulse 2>/dev/null || true
|
|
delgroup pulse 2>/dev/null || true
|
|
|
|
# Create new group and user with desired IDs
|
|
addgroup -g "$PGID" pulse
|
|
adduser -D -u "$PUID" -G pulse pulse
|
|
fi
|
|
|
|
# Fix ownership of data directory
|
|
chown -R pulse:pulse /data /app /etc/pulse /opt/pulse
|
|
|
|
# Switch to pulse user
|
|
exec su-exec pulse "$@"
|
|
else
|
|
# Not running as root, just exec the command
|
|
exec "$@"
|
|
fi
|