aboutsummaryrefslogtreecommitdiff
path: root/net/traefik2/files/traefik.in
blob: 1e574b54dbd21865e7a337795d1df0988bb048b5 (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
45
46
47
48
49
50
51
#!/bin/sh

# PROVIDE: traefik
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# traefik_enable (bool):	Set to NO by default.
#				Set it to YES to enable traefik.
# traefik_user (user):		Set user to run traefik.
#				Default is "traefik".
# traefik_group (group):	Set group to run traefik.
#				Default is "traefik".
# traefik_conf (path):		Path to traefik configuration file.
#				Default is %%PREFIX%%/etc/traefik.toml
# traefik_env (vars):		Set environment variables used with traefik
#				Default is "".
#				These are necessary for ACME (Let's Encrypt)
#				configuration, see
#				https://docs.traefik.io/configuration/acme/

. /etc/rc.subr

name=traefik
rcvar=traefik_enable

load_rc_config $name

: ${traefik_enable:="NO"}
: ${traefik_user:="traefik"}
: ${traefik_group:="traefik"}
: ${traefik_conf:="%%PREFIX%%/etc/traefik.toml"}
: ${traefik_env:=""}

pidfile=/var/run/traefik.pid
procname="%%PREFIX%%/bin/traefik"
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} /usr/bin/env ${traefik_env} ${procname} --configFile=${traefik_conf} ${traefik_args}"

start_precmd=traefik_startprecmd

traefik_startprecmd()
{
        if [ ! -e ${pidfile} ]; then
                install -o ${traefik_user} -g ${traefik_group} /dev/null ${pidfile};
        fi
}

run_rc_command "$1"