#!/bin/sh

# PROVIDE: kanidmd
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add these lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# kanidmd_enable (bool):        Enable kanidmd. (default=NO)
# kanidmd_config (str):         Configuration file.
#                               (default=%%ETCDIR%%/config.toml)

. /etc/rc.subr

name=kanidmd
rcvar=kanidmd_enable

load_rc_config $name

: ${kanidmd_enable:="NO"}
: ${kanidmd_config:="%%ETCDIR%%/config.toml"}

pidfile="/var/run/kanidmd.pid"
command=/usr/sbin/daemon
command_args="-u %%USER%% -p /var/run/kanidmd.pid -T kanidmd %%PREFIX%%/libexec/${name} server --config-path ${kanidmd_config}"
procname=%%PREFIX%%/libexec/${name}

run_rc_command "$1"
