# Copyright (C) Inverse inc.
[Unit]
Description=PacketFence API frontend Service
Wants=packetfence-base.target packetfence-config.service packetfence-iptables.service
After=packetfence-base.target packetfence-config.service packetfence-iptables.service
Before=packetfence-httpd.portal.service
Before=packetfence-docker-iptables.service
Requires=packetfence-docker-iptables.service
PartOf=packetfence-docker-iptables.service

[Service]
Type=notify
TimeoutStopSec=60
NotifyAccess=all
LimitNOFILE=infinity
ExecStartPre=/bin/perl -I/usr/local/pf/lib -I/usr/local/pf/lib_perl/lib/perl5 '-Mpf::services::manager::api_frontend' -e 'pf::services::manager::api_frontend->new()->generateConfig()'
ExecStart=/usr/local/pf/sbin/api-frontend-docker-wrapper
ExecStop=/bin/bash -c "docker stop api-frontend ; echo Stopped"
Restart=on-failure
Slice=packetfence.slice
PIDFile=/usr/local/pf/var/run/api-frontend-systemd-notify.pid

[Install]
WantedBy=packetfence.target
