# Vapor media server — systemd unit.
#
# Installed by install.sh (which substitutes User= when VAPOR_USER is set).
# Restart=always is half of the auto-update story: the server checks the
# release manifest daily and swaps /opt/vapor/vapord in place; the new
# binary takes over on the next restart (a crash, a reboot, or a manual
# `systemctl restart vapor`). The server never exec-restarts itself.

[Unit]
Description=Vapor media server
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=vapor
WorkingDirectory=/var/lib/vapor
ExecStart=/opt/vapor/vapord -db /var/lib/vapor/library.db
# Optional overrides (MEDIASERVER_ADDR, MEDIASERVER_UPDATE_MANIFEST,
# MEDIASERVER_NO_SELFUPDATE=1, media credentials, …), one KEY=value per line.
EnvironmentFile=-/etc/vapor/vapor.env
Restart=always
RestartSec=5
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target
