Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Mar 2023 19:59:48 GMT
From:      Adam Weinberger <adamw@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: b45468408f73 - main - www/caddy{,-custom}: Fix startup with JSON configuration
Message-ID:  <202303111959.32BJxm1c001922@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by adamw:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b45468408f73857aa7a0f4e62ee852baebb52bfa

commit b45468408f73857aa7a0f4e62ee852baebb52bfa
Author:     Pawel Krawczyk <pawel.krawczyk@hush.com>
AuthorDate: 2023-03-11 19:57:30 +0000
Commit:     Adam Weinberger <adamw@FreeBSD.org>
CommitDate: 2023-03-11 19:59:20 +0000

    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
---
 www/caddy-custom/Makefile       | 2 +-
 www/caddy-custom/files/caddy.in | 8 +++++++-
 www/caddy/Makefile              | 2 +-
 www/caddy/files/caddy.in        | 8 +++++++-
 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}"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202303111959.32BJxm1c001922>