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

WIKIJS_USER=${WIKIJS_USER:-wikijs}
WIKIJS_GROUP=${WIKIJS_GROUP:-wikijs}

description="Modern, lightweight and powerful wiki app built on Nodejs"
command="/usr/bin/node server"
command_args="${WIKIJS_OPTS}"
pidfile="/run/${RC_SVCNAME}.pid"
directory="${WIKIJS_HOMEDIR}"
command_background="yes"
command_user="${WIKIJS_USER}:${WIKIJS_GROUP}"

depend() {
  need net
}

start_pre() {
  checkpath -q -d -o ${WIKIJS_USER}:${WIKIJS_GROUP} ${directory}
}
