#!/sbin/openrc-run

name=gotosocial
command="/usr/bin/gotosocial"
command_args="server start --config-path=/etc/gotosocial/gotosocial.yml"
command_background=true
pidfile="/run/${RC_SVCNAME}.pid"
error_log="/var/log/gotosocial.log"
output_log="/var/log/gotosocial.log"

command_user="gotosocial:gotosocial"

start_pre() {
	checkpath -f --owner "$command_user" --mode 0640 \
		/etc/gotosocial/gotosocial.yml
	checkpath -f --owner "$command_user" --mode 0644 \
		/var/log/gotosocial.log
	checkpath -d --owner "$command_user" --mode 0755 \
		/var/lib/gotosocial/
}

depend() {
	need net
	after firewall
}
