#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

VLS_CFGFILE="${VLS_CFGFILE:-/etc/vuls/server-config.toml}"
VLS_LOGDIR="${VLS_LOGDIR:-/var/log/vuls}"

USER="vuls"
GROUP="vuls"

description="Using vuls as server mode"
command="/usr/lib/go-gentoo/bin/vuls"
command_background="true"
command_user="${USER}:${GROUP}"
required_dirs="${VLS_LOGDIR}"
required_files="${VLS_CFGFILE}"

command_args="server
	-listen=${VLS_LISTEN:-127.0.0.1:5515}
	-config=${VLS_CFGFILE}
	-results-dir=${VLS_RESULTSDIR:-/var/lib/vuls/results}
	-log-dir=${VLS_LOGDIR}
	${VLS_OPTS}"

pidfile="/run/${RC_SVCNAME}.pid"
retry="TERM/25/KILL/5"
start_stop_daemon_args="--quiet -1 ${VLS_LOGDIR}/vuls.log -2 ${VLS_LOGDIR}/vuls.log"

depend() {
	need go-cve-dictionary goval-dictionary gost-daemon
}

# vim: set ft=gentoo-init-d ts=4 :
