[Unit]
Description=ONCP Master Node - Control Plane API
After=network.target
Documentation=https://github.com/ospab/ospab.network

[Service]
Type=simple
User=root
WorkingDirectory=/var/lib/ostp
Environment="ONCP_DATABASE=/var/lib/ostp/oncp.db"
Environment="ONCP_NETWORK_OCTET=42"
Environment="ONCP_LOG_LEVEL=info"
ExecStart=/usr/local/bin/oncp-master serve --listen 0.0.0.0:8080 --network-octet 42
Restart=on-failure
RestartSec=5s
StandardOutput=append:/var/log/ostp/oncp-master.log
StandardError=append:/var/log/ostp/oncp-master.log

# Security hardening
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/lib/ostp /var/log/ostp

# Resource limits
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target
