[Unit]
Description=LibreTime API Service
Requires=libretime-api.socket
PartOf=libretime.target

[Service]
Type=notify
KillMode=mixed
PrivateTmp=true

Environment=LIBRETIME_LOG_FILEPATH=@@LOG_DIR@@/api.log
Environment=LIBRETIME_CONFIG_FILEPATH=@@CONFIG_FILEPATH@@

ExecStart=/usr/bin/gunicorn \
        --workers 4 \
        --worker-class uvicorn.workers.UvicornWorker \
        --log-file - \
        --bind unix:/run/libretime-api.sock \
        libretime_api.asgi
ExecReload=/bin/kill -s HUP $MAINPID
User=libretime
Group=libretime
Restart=always

[Install]
WantedBy=multi-user.target
