#!/sbin/openrc-run

: ${command_user:="kuma:kuma"}

name=kuma-cp
description="Kuma control plane"
command="/usr/bin/kuma-cp"
command_args="
	run
	${logfile:+"--log-output-path \"$logfile\""}
	${configfile:+"--config-file \"$configfile\""}
	${command_args:-}
	"
command_background="yes"
pidfile="/run/$RC_SVCNAME.pid"

KUMA_MODE="standalone"

depend() {
	need net
	after firewall
}

start_pre() {
	checkpath -d -o "$command_user" /var/lib/kuma /var/log/kuma
	if [ -n "$logfile" ]; then
		checkpath -f -m 640 -o "$command_user" "$logfile"
	fi
}
