#!/bin/sh

# PROVIDE: artificer

. /etc/rc.subr

name="artificer"
rcvar="artificer_enable"
pidfile="/var/dbots/TheArtificer/artificer.pid"

artificer_root="/var/dbots/TheArtificer"
artificer_write="./logs/,./src/endpoints/gets/heatmap.png"
artificer_read="./src/artigen/,./src/endpoints/gets/heatmap-base.png,./src/endpoints/gets/heatmap.png,./config.ts,./flags.ts"
artificer_log="/var/log/artificer.log"

artificer_chdir="${artificer_root}"
command="/usr/sbin/daemon"
command_args="-f -R 5 -P ${pidfile} -o ${artificer_log} /usr/local/bin/deno run --allow-write=${artificer_write} --allow-read=${artificer_read} --allow-net --allow-import ${artificer_root}/mod.ts"

load_rc_config artificer
run_rc_command "$1"
