[Unit]
Description=Generate SSL certificate for Dangerous Pi
Documentation=https://github.com/yourusername/dangerous-pi
Before=dangerous-pi-nginx-config.service nginx.service
After=local-fs.target

# Only run if certificate doesn't exist
ConditionPathExists=!/opt/dangerous-pi/ssl/dangerous-pi.crt

[Service]
Type=oneshot
ExecStart=/opt/dangerous-pi/scripts/generate-ssl-cert.sh
RemainAfterExit=yes

# Run as root to set proper permissions
User=root
Group=root

# Timeout for certificate generation
TimeoutStartSec=30

[Install]
WantedBy=multi-user.target
