[Unit]
Description=WHP WebSocket Terminal Server
After=network.target mariadb.service

[Service]
Type=simple
User=root
WorkingDirectory=/root/whp/terminal-server
ExecStart=/root/.nvm/versions/node/v22.17.1/bin/node /root/whp/terminal-server/server.js
Restart=always
RestartSec=10

# Environment variables
Environment="NODE_ENV=production"
Environment="NVM_DIR=/root/.nvm"
Environment="PATH=/root/.nvm/versions/node/v22.17.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Security
NoNewPrivileges=true
PrivateTmp=true

# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=whp-terminal

[Install]
WantedBy=multi-user.target