#!/sbin/openrc-run
supervisor=supervise-daemon

name="PeerTube"
description="PeerTube self-hosted streaming service"
pidfile=/run/peertube/peertube.pid
output_log=/var/log/peertube/peertube.log
error_log="$output_log"
command_background=true
command_user="peertube:peertube"
command=/usr/bin/node
command_args="${directory}/dist/server"
required_dirs="$directory $NODE_CONFIG_DIR"

depend() {
	after redis postgresql
}

start_pre() {
	checkpath --directory --owner "$command_user" --mode 0750 "${pidfile%/*}"
	checkpath --directory --owner "$command_user" --mode 0750 "${output_log%/*}"
}
