ports/security/ruby-bitwarden/files/rubywarden-api.in
Michael Reifenberger 61f46537a3 Add rubywarden (formerly known as bitwarden-ruby)
a small, self-contained API server written in Ruby and Sinatra to provide a private backend for the open-source Bitwarden apps.
This port follows the bitwarden-ruby port which was created and maintained by feld@ but doesnt try to manage all ruby dependencies.
2019-03-10 13:07:06 +00:00

48 lines
1.1 KiB
Bash

#!/bin/sh
#
# Created by: Mark Felder <feld@FreeBSD.org>
# $FreeBSD$
#
# PROVIDE: rubywarden-api
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable `rubywarden-api':
#
# rubywarden_api_enable="YES"
. /etc/rc.subr
name=rubywarden_api
rcvar=rubywarden_api_enable
load_rc_config ${name}
: ${rubywarden_api_enable:=NO}
: ${rubywarden_api_port:=4567}
: ${rubywarden_api_signups:=NO}
: ${rubywarden_api_user:=www}
: ${rubywarden_api_group:=www}
: ${rubywarden_api_chdir=/usr/local/www/rubywarden}
pidfile="/var/run/rubywarden/${name}.pid"
procname=%%RUBY_WITH_SUFFIX%%
command="%%PREFIX%%/bin/rackup"
command_args="-P ${pidfile} -p ${rubywarden_api_port} -E production config.ru 2>&1 | logger -t rubywarden &"
start_precmd="start_precmd"
start_precmd()
{
if [ ! -e /var/run/rubywarden ] ; then
install -d -o ${rubywarden_api_user} -g ${rubywarden_api_group} /var/run/rubywarden;
fi
checkyesno rubywarden_api_signups
if [ "$?" -eq 0 ]; then
export ALLOW_SIGNUPS=1
echo "Bitwarden Signups Enabled"
fi
}
run_rc_command "$1"