net-mgmt/telegraf: Add a rc.conf option for the --config-directory option

While we're here:

 - Sort ONLY_FOR_ARCHS as per portlint
 - Match "telegraf -h" usage message (-quiet, -config -> --quiet, --config)

PR:		239291
Approved by:	girgen (maintainer timeout, 9 weeks), matthew (mentor, implicit)
This commit is contained in:
Craig Leres 2019-09-25 20:03:48 +00:00
parent 94ef61e506
commit 1bb8f03c78
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=512808
2 changed files with 12 additions and 4 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= telegraf
DISTVERSION= 1.12.1
PORTREVISION= 1
CATEGORIES= net-mgmt
MAINTAINER= girgen@FreeBSD.org
@ -10,7 +11,7 @@ COMMENT= Time-series data collection
LICENSE= MIT
ONLY_FOR_ARCHS= amd64 i386 armv6 armv7
ONLY_FOR_ARCHS= amd64 armv6 armv7 i386
USES= go

View File

@ -13,12 +13,14 @@
# Default: NO
# telegraf_conf (str): telegraf configuration file
# Default: ${PREFIX}/etc/telegraf.conf
# telegraf_confdir (str): telegraf configuration directory
# Default: none
# telegraf_user (str): telegraf daemon user
# Default: %%TELEGRAF_USER%%
# telegraf_group (str): telegraf daemon group
# Default: %%TELEGRAF_GROUP%%
# telegraf_flags (str): Extra flags passed to telegraf
# Default: -quiet
# Default: --quiet
. /etc/rc.subr
@ -31,9 +33,14 @@ load_rc_config $name
: ${telegraf_enable:="NO"}
: ${telegraf_user:="%%TELEGRAF_USER%%"}
: ${telegraf_group:="%%TELEGRAF_GROUP%%"}
: ${telegraf_flags:="-quiet"}
: ${telegraf_flags:="--quiet"}
: ${telegraf_conf:="%%PREFIX%%/etc/${name}.conf"}
: ${telegraf_options:="${telegraf_flags} -config=${telegraf_conf}"}
: ${telegraph_confdir:=""}
: ${telegraf_options:="${telegraf_flags} --config=${telegraf_conf}"}
if [ -n "${telegraf_confdir}" ]; then
telegraf_options="${telegraf_options} --config-directory=${telegraf_confdir}"
fi
logfile="%%TELEGRAF_LOGDIR%%/${name}.log"
pidfile="/var/run/${name}.pid"