#!/sbin/openrc-run
# OpenRC twin of yes-site.service (+ yes-site.socket: no socket activation here, the binary binds YES_LISTEN itself).
description="YES site (server-rendered embed catalog)"
supervisor=supervise-daemon
command=/usr/bin/yes-site
command_args="serve ${yes_site_args}"
command_user="yes-site:yes-site"
pidfile="/run/${RC_SVCNAME}.pid"
no_new_privs=yes
retry="TERM/15/KILL/5"
respawn_delay=3
respawn_max=0

depend() {
	need net
	use dns
}

start_pre() {
	# systemd EnvironmentFile= twins: yes-site.env, then the optional secrets file
	set -a
	. /etc/yes-site/yes-site.env
	[ -r /etc/yes-site/secrets.env ] && . /etc/yes-site/secrets.env
	set +a
	checkpath -d -m 0750 -o yes-site:yes-site /var/lib/yes-site
}
