ports/mail/mailhog/files/mailhog.in
Einar Bjarni Halldórsson 3f78f6fb2b mail/mailhog: Add sysrc variable to set hostname parameter
This patch adds the sysrc variable "mailhog_hostname".
By setting the variable, we can configure the hostname mailhog uses for
EHLO/HELO and message IDs

PR:		272130
2023-07-31 09:42:14 +01:00

46 lines
1.7 KiB
Bash

#!/bin/sh
# PROVIDE: mailhog
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add these lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# mailhog_enable (bool): Set to NO by default.
# Set it to YES to enable mailhog.
# mailhog_bind_addr (ipaddr): Set to the address mailhog should listen on
# for incoming connections. 127.0.0.1 by default.
# mailhog_smtp_port (int): Port to listen on for SMTP. 1025 by default.
# mailhog_api_port (int): Port to listen on for API. 8025 by default.
# mailhog_ui_port (int): Port to listen on for UI. 8025 (same as API)
# by default.
# mailhog_runtimeuser (string): User mailhog should run as. 'nobody' by default.
# mailhog_hostname (string): Hostname to use for EHLO/HELO and message IDs.
# mailhog.example.com by default.
#
# Please think twice before exposing this server to the Internet. This is an
# insecure tool without any authentication specifically to aid development
# and debugging. Use in controlled environments only is highly recommended.
#
. /etc/rc.subr
name="mailhog"
rcvar="mailhog_enable"
pidfile="/var/run/${name}.pid"
: ${mailhog_enable:="NO"}
: ${mailhog_bind_addr:="127.0.0.1"}
: ${mailhog_smtp_port:="1025"}
: ${mailhog_api_port:="8025"}
: ${mailhog_ui_port:="8025"}
: ${mailhog_runtimeuser:="nobody"}
: ${mailhog_hostname:="mailhog.example"}
load_rc_config "${name}"
command="/usr/sbin/daemon"
command_args="-c -r -f -P ${pidfile} -u ${mailhog_runtimeuser} %%PREFIX%%/bin/${name} -api-bind-addr ${mailhog_bind_addr}:${mailhog_api_port} -ui-bind-addr ${mailhog_bind_addr}:${mailhog_ui_port} -smtp-bind-addr ${mailhog_bind_addr}:${mailhog_smtp_port} -hostname ${mailhog_hostname}"
run_rc_command "$1"