From a866b33f0be7c276e51d009b7b067da4623c52b6 Mon Sep 17 00:00:00 2001
From: Lukasz Nowak <luke@nexedi.com>
Date: Fri, 26 Apr 2019 11:18:13 +0200
Subject: [PATCH] component/caddy: Switch to nxd-v0.11.5-4-g9d3151db

This reverts commit 6d2019b965f4a3521b651f2cb9ef241dce29af55, as new caddy
has issues with tls certificate configuration:
https://github.com/mholt/caddy/issues/2588

About nxd-v0.11.5-4-g9d3151db:

 * not released yet functionality for regular expression cookie rewriting
   is available: https://github.com/mholt/caddy/pull/2144

 * not released yet functionality for ca_certifices in proxy:
   https://github.com/mholt/caddy/pull/2380

 * support for builtin log rotation disabling
---
 component/caddy/buildout.cfg | 33 ++++++++++++---------------------
 component/caddy/gowork.cfg   | 13 +++++++++++++
 2 files changed, 25 insertions(+), 21 deletions(-)
 create mode 100644 component/caddy/gowork.cfg

diff --git a/component/caddy/buildout.cfg b/component/caddy/buildout.cfg
index 116720c16..22ecdcf94 100644
--- a/component/caddy/buildout.cfg
+++ b/component/caddy/buildout.cfg
@@ -1,35 +1,26 @@
 [buildout]
 extends =
   ../../component/golang/buildout.cfg
+  gowork.cfg
 
 parts =
+  gowork
   caddy
 
 [gowork]
-# Caddy 1.x+ uses go modules, for which gowork does not work yet
 golang  = ${golang1.12:location}
 install =
-
-[gowork.goinstall]
-command = :
-depends =
-  ${caddy:recipe}
+  github.com/mholt/caddy
 
 [caddy]
-# revision and repository can be used to control which caddy version is used
-revision = 0c3d90ed21a4df1b5e75ff4d5f908fd3018f902c
-repository = github.com/mholt/caddy/caddy
-
-recipe  = plone.recipe.command
-update-command = ${:command}
-stop-on-error = True
-# GO111MODULE=on enables go modules support
-# the chmod is needed as modules are fetched with u-w
-command =
-  . ${gowork:env.sh} &&
-  cd ${gowork:directory} &&
-  export GO111MODULE=on &&
-  go get ${:repository}@${:revision} &&
-  chmod -R u+w .
+recipe  = slapos.recipe.cmmi
+path    = ${go_github.com_mholt_caddy:location}
+go      = ${gowork:golang}/bin/go
+configure-command = :
+make-targets =
+make-binary = cd ${:path}/caddy  && ${:go} install -v
+environment =
+  PATH=${pkgconfig:location}/bin:${gowork:golang}/bin:${buildout:bin-directory}:%(PATH)s
+  GOPATH=${gowork:directory}
 output = ${gowork:bin}/caddy
 location = ${:output}
diff --git a/component/caddy/gowork.cfg b/component/caddy/gowork.cfg
new file mode 100644
index 000000000..a91934ea8
--- /dev/null
+++ b/component/caddy/gowork.cfg
@@ -0,0 +1,13 @@
+# Code generated by gowork-snapshot; DO NOT EDIT.
+
+# list of go git repositories to fetch
+[gowork.goinstall]
+depends_gitfetch  =
+    ${go_github.com_mholt_caddy:recipe}
+
+
+[go_github.com_mholt_caddy]
+<= go-git-package
+go.importpath = github.com/mholt/caddy
+repository    = https://lab.nexedi.com/nexedi/caddy.git
+revision      = nxd-v0.11.5-4-g9d3151db
-- 
2.30.9