- Add install.sh orchestrator with upgrade support - Add 6 helper scripts (<100 lines each) replacing 700-800 line monsters - Add deployment/linux/furt.service systemd template - Support both fresh install and upgrade modes - Platform-aware detection (OpenBSD/FreeBSD vs Linux) - Skip user/service creation in upgrade mode - Preserve existing configuration during updates - Remove merkwerk dependency from production install script Helper scripts: - scripts/setup-user.sh - Create system user (_furt/furt) - scripts/setup-directories.sh - Create directory structure - scripts/sync-files.sh - Copy source files to installation - scripts/create-service.sh - Create system service from templates - scripts/validate-config.sh - Validate furt.conf syntax - scripts/health-check.sh - Basic health check functionality Closes DAW/furt#87
49 lines
1.2 KiB
Bash
Executable file
49 lines
1.2 KiB
Bash
Executable file
#!/bin/sh
|
|
# scripts/validate-config.sh - Validate furt configuration
|
|
|
|
set -e
|
|
|
|
# Detect config file location
|
|
if [ "$(uname)" = "OpenBSD" ] || [ "$(uname)" = "FreeBSD" ]; then
|
|
CONFIG_FILE="/usr/local/etc/furt/furt.conf"
|
|
else
|
|
CONFIG_FILE="/etc/furt/furt.conf"
|
|
fi
|
|
|
|
echo "Validating configuration: $CONFIG_FILE"
|
|
|
|
# Check if config file exists
|
|
if [ ! -f "$CONFIG_FILE" ]; then
|
|
echo "Error: Configuration file not found: $CONFIG_FILE"
|
|
exit 1
|
|
fi
|
|
|
|
# Basic INI syntax validation
|
|
if ! grep -q '^\[server\]' "$CONFIG_FILE"; then
|
|
echo "Error: [server] section missing in config"
|
|
exit 1
|
|
fi
|
|
|
|
if ! grep -q '^port\s*=' "$CONFIG_FILE"; then
|
|
echo "Error: server port not configured"
|
|
exit 1
|
|
fi
|
|
|
|
if ! grep -q '^host\s*=' "$CONFIG_FILE"; then
|
|
echo "Error: server host not configured"
|
|
exit 1
|
|
fi
|
|
|
|
# Check for at least one API key
|
|
if ! grep -q '^\[api_key' "$CONFIG_FILE"; then
|
|
echo "Warning: No API keys configured"
|
|
fi
|
|
|
|
# Check permissions (should not be world-readable due to secrets)
|
|
PERMS=$(stat -c '%a' "$CONFIG_FILE" 2>/dev/null || stat -f '%Lp' "$CONFIG_FILE")
|
|
if [ "$PERMS" -gt 640 ]; then
|
|
echo "Warning: Config file permissions too open ($PERMS), should be 640"
|
|
fi
|
|
|
|
echo "Configuration validation completed"
|
|
|