aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Krawczyk <pawel.krawczyk@hush.com>2023-03-11 19:57:30 +0000
committerAdam Weinberger <adamw@FreeBSD.org>2023-03-11 19:59:20 +0000
commitb45468408f73857aa7a0f4e62ee852baebb52bfa (patch)
tree06a33d3d4951ba27f2143ee1c40db05cbd7b0133
parent67e2d335976b758cdb760da6dd1702da9d0703c7 (diff)
downloadports-b45468408f73857aa7a0f4e62ee852baebb52bfa.tar.gz
ports-b45468408f73857aa7a0f4e62ee852baebb52bfa.zip
www/caddy{,-custom}: Fix startup with JSON configuration
Caddy supports a wide number of configuration file formats, including its built-in "Caddyfile" format, and the "native" format is JSON. When anything other than the native JSON format is used, caddy needs to be passed the --adapter [formatname] flag (though it automatically handles the case where the config filename is Caddyfile). However, as JSON is the native format, there is no "json" adapter. The added patch drops the --adapter flag when caddy_adapter is "json". PR: 270120
-rw-r--r--www/caddy-custom/Makefile2
-rw-r--r--www/caddy-custom/files/caddy.in8
-rw-r--r--www/caddy/Makefile2
-rw-r--r--www/caddy/files/caddy.in8
4 files changed, 16 insertions, 4 deletions
diff --git a/www/caddy-custom/Makefile b/www/caddy-custom/Makefile
index c027f598f375..667dc06d78ed 100644
--- a/www/caddy-custom/Makefile
+++ b/www/caddy-custom/Makefile
@@ -4,7 +4,7 @@
PORTNAME= caddy-custom
PORTVERSION= ${CADDY_VERSION}.${XCADDY_VERSION}
-PORTREVISION= 5
+PORTREVISION= 6
CATEGORIES= www
DISTFILES= # none
diff --git a/www/caddy-custom/files/caddy.in b/www/caddy-custom/files/caddy.in
index 1fc835401889..7ce2aea7e21b 100644
--- a/www/caddy-custom/files/caddy.in
+++ b/www/caddy-custom/files/caddy.in
@@ -54,7 +54,6 @@ load_rc_config $name
export XDG_CONFIG_HOME XDG_DATA_HOME
command="${caddy_command}"
-caddy_flags="--config ${caddy_config} --adapter ${caddy_adapter}"
pidfile="/var/run/${name}/${name}.pid"
required_files="${caddy_config} ${caddy_command}"
@@ -63,6 +62,13 @@ start_precmd="caddy_precmd"
start_cmd="caddy_start"
stop_precmd="caddy_prestop"
+# JSON is the native format, so there is no "adapter" for it
+if [ "${caddy_adapter}" = "json" ]; then
+ caddy_flags="--config ${caddy_config}"
+else
+ caddy_flags="--config ${caddy_config} --adapter ${caddy_adapter}"
+fi
+
# Extra Commands
extra_commands="configtest reload"
configtest_cmd="caddy_execute validate ${caddy_flags}"
diff --git a/www/caddy/Makefile b/www/caddy/Makefile
index de2eacb0418e..c119180be6b9 100644
--- a/www/caddy/Makefile
+++ b/www/caddy/Makefile
@@ -1,7 +1,7 @@
PORTNAME= caddy
DISTVERSIONPREFIX= v
DISTVERSION= 2.6.4
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= www
DIST_SUBDIR= caddy
diff --git a/www/caddy/files/caddy.in b/www/caddy/files/caddy.in
index 85251ab1c02a..17724715ae5c 100644
--- a/www/caddy/files/caddy.in
+++ b/www/caddy/files/caddy.in
@@ -54,7 +54,6 @@ load_rc_config $name
export XDG_CONFIG_HOME XDG_DATA_HOME
command="${caddy_command}"
-caddy_flags="--config ${caddy_config} --adapter ${caddy_adapter}"
pidfile="/var/run/${name}/${name}.pid"
required_files="${caddy_config} ${caddy_command}"
@@ -63,6 +62,13 @@ start_precmd="caddy_precmd"
start_cmd="caddy_start"
stop_precmd="caddy_prestop"
+# JSON is the native format, so there is no "adapter" for it
+if [ "${caddy_adapter}" = "json" ]; then
+ caddy_flags="--config ${caddy_config}"
+else
+ caddy_flags="--config ${caddy_config} --adapter ${caddy_adapter}"
+fi
+
# Extra Commands
extra_commands="configtest reload"
configtest_cmd="caddy_execute validate ${caddy_flags}"