Subject: bug#71676: closed (Re: [bug#71676] [PATCH v3] services: nginx-upstream-configuration: Allow file-like objects)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 20 Nov 2024 22:42:01 +0000

Your bug report

#71676: [PATCH] services: nginx-upstream-configuration: Allow file-like objects

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
71676: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71676
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#71676] [PATCH v3] services: nginx-upstream-configuration: Allow file-like objects
From: Ludovic Courtès <[email-masked]>
To: Tomas Volf <[email-masked]>
Cc: [email-masked], Florian Pelz <[email-masked]>, Maxim Cournoyer <[email-masked]>
Date: Wed, 20 Nov 2024 23:41:17 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Tomas Volf <[email-masked]> skribis:

> * gnu/services/web.scm (emit-nginx-upstream-config): Support file-like
> objects.
> * doc/guix.texi (Web Services)[nginx-upstream-configuration]: Document it.
>
> Change-Id: I49996e358174dc77b31e3c91b908a6a72f3eb705
> ---
> v2: Keep support for plain string or file-like object.  I did not realize
>     that flatten also accepts non-lists and wraps them in a list.
> v3: Rebase on latest master.

Applied, thanks!

Subject: [PATCH] services: nginx-upstream-configuration: Allow file-like objects
From: Tomas Volf <[email-masked]>
To: [email-masked]
Cc: Tomas Volf <[email-masked]>
Date: Thu, 20 Jun 2024 15:04:03 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/services/web.scm (emit-nginx-upstream-config): Support file-like
objects.
* doc/guix.texi (Web Services)[nginx-upstream-configuration]: Document it.

Change-Id: I49996e358174dc77b31e3c91b908a6a72f3eb705
---
This unifies the behavior with extra-content field in nginx-configuration.

 doc/guix.texi        | 11 ++++++++++-
 gnu/services/web.scm |  4 ++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 55710dc968..f6f2788ed2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -32095,7 +32095,16 @@ Web Services
 explicitly.

 @item @code{extra-content}
-A string or list of strings to add to the upstream block.
+Additional content to be appended to the upstream block.  Can be a
+string or file-like object or list of thereof.  In case of list, each
+item is prefixed with indentation and suffixed with a new line.  Nested
+lists are flattened.
+
+@lisp
+(extra-content "include /etc/nginx/custom-config.conf;")
+(extra-content `("include /etc/nginx/custom-config.conf;"
+                 ("include " ,%custom-config.conf ";")))
+@end lisp

 @end table
 @end deftp
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 340988fdd8..7424f7302f 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -701,8 +701,8 @@ (define (emit-nginx-upstream-config upstream)
          (cons
           "\n"
           (map (lambda (line)
-                 (simple-format #f "      ~A\n" line))
-               (flatten extra-content)))
+                 `("      " ,line "\n"))
+               extra-content))
          '()))
    "    }\n"))

--
2.45.1