aboutsummaryrefslogtreecommitdiff
path: root/www/garage/files/garage.in
blob: 92e9158feed07aada09bec01b7d317e0ebde5009 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh

# PROVIDE: garage
# REQUIRE: NETWORKING
# KEYWORD: shutdown

# Configuration settings for Garage in /etc/rc.conf
#
# garage_enable (bool):     Enable Garage. (default=NO)
# garage_config (str):      Garage configuration file. (default=%%PREFIX%%/etc/garage.toml)
# garage_log_file (str):    Log output. May be set to syslog. (default=/var/log/garage.log)
# garage_runas (str):       User to run Garage as. (default=%%USER%%)
#

. /etc/rc.subr

name=garage
desc="Distributed object storage"
rcvar=${name}_enable

# read configuration and set defaults
load_rc_config $name
: ${garage_enable="NO"}
: ${garage_config="%%PREFIX%%/etc/garage.toml"}
: ${garage_log_file="/var/log/garage.log"}
: ${garage_runas:="%%USER%%"}

command=/usr/sbin/daemon
procname="%%PREFIX%%/bin/${name}"
required_files="${garage_config}"
pidfile="/var/run/${name}.pid"
command_args=

if [ "${garage_log_file}" = syslog ]; then
	garage_env="${garage_env} GARAGE_LOG_TO_SYSLOG=1"
else
	command_args="-H -o ${garage_log_file}"
fi

command_args="${command_args} -f -u ${garage_runas} -p ${pidfile} ${procname} -c ${garage_config} server"

status_cmd="${procname} -c ${garage_config} status"

run_rc_command "$1"