[Unit]
Description=Bridge-and-Join-s — Crypto sidecar (Java + Валидата Клиент L)
Documentation=https://git.zetit.ru/zuevav/Bridge-and-Join-s
Before=bj-server.service
After=network-online.target pcscd.service
Wants=network-online.target

[Service]
Type=simple
User=bj
Group=bj
RuntimeDirectory=bj
RuntimeDirectoryMode=0750
Environment=BJ_CRYPTO_SOCKET=/run/bj/crypto.sock
Environment=BJ_CRYPTO_PROVIDER=validata
Environment=LD_LIBRARY_PATH=/opt/Validata/VDCSP/lib/amd64

ExecStart=/usr/bin/java \
    -Djava.library.path=/opt/Validata/VDCSP/lib/amd64 \
    -jar /opt/bj/crypto-service.jar

Restart=on-failure
RestartSec=5

StandardOutput=append:/var/log/bj/crypto-service.log
StandardError=append:/var/log/bj/crypto-service.err

NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/run/bj /var/log/bj
PrivateTmp=true

[Install]
WantedBy=multi-user.target
