GNU bug report logs - #71676
[PATCH] services: nginx-upstream-configuration: Allow file-like objects

Previous Next

Package: guix-patches;

Reported by: Tomas Volf <~@wolfsden.cz>

Date: Thu, 20 Jun 2024 13:06:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 71676 in the body.
You can then email your comments to 71676 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, matt <at> excalamus.com, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org:
bug#71676; Package guix-patches. (Thu, 20 Jun 2024 13:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tomas Volf <~@wolfsden.cz>:
New bug report received and forwarded. Copy sent to pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, matt <at> excalamus.com, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org. (Thu, 20 Jun 2024 13:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tomas Volf <~@wolfsden.cz>
To: guix-patches <at> gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH] services: nginx-upstream-configuration: Allow file-like
 objects
Date: Thu, 20 Jun 2024 15:04:03 +0200
* 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




Information forwarded to pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, matt <at> excalamus.com, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org:
bug#71676; Package guix-patches. (Thu, 20 Jun 2024 20:26:02 GMT) Full text and rfc822 format available.

Message #8 received at 71676 <at> debbugs.gnu.org (full text, mbox):

From: Tomas Volf <~@wolfsden.cz>
To: 71676 <at> debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH v2] services: nginx-upstream-configuration: Allow file-like
 objects
Date: Thu, 20 Jun 2024 22:23:04 +0200
* 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.

 doc/guix.texi        | 11 ++++++++++-
 gnu/services/web.scm |  6 ++++--
 2 files changed, 14 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..8d81c926e8 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -701,8 +701,10 @@ (define (emit-nginx-upstream-config upstream)
          (cons
           "\n"
           (map (lambda (line)
-                 (simple-format #f "      ~A\n" line))
-               (flatten extra-content)))
+                 `("      " ,line "\n"))
+               (if (list? extra-content)
+                   extra-content
+                   (list extra-content))))
          '()))
    "    }\n"))

--
2.45.1




Information forwarded to pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org:
bug#71676; Package guix-patches. (Sun, 06 Oct 2024 15:24:02 GMT) Full text and rfc822 format available.

Message #11 received at 71676 <at> debbugs.gnu.org (full text, mbox):

From: Tomas Volf <~@wolfsden.cz>
To: 71676 <at> debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH v3] services: nginx-upstream-configuration: Allow file-like
 objects
Date: Sun,  6 Oct 2024 17:22:57 +0200
* 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.

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

diff --git a/doc/guix.texi b/doc/guix.texi
index 52e36e4354..b45b7c2c93 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -32229,7 +32229,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 cc6f4e6d9b..39c0035405 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -703,8 +703,10 @@ (define (emit-nginx-upstream-config upstream)
          (cons
           "\n"
           (map (lambda (line)
-                 (simple-format #f "      ~A\n" line))
-               (flatten extra-content)))
+                 `("      " ,line "\n"))
+               (if (list? extra-content)
+                   extra-content
+                   (list extra-content))))
          '()))
    "    }\n"))

--
2.46.0




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 20 Nov 2024 22:42:01 GMT) Full text and rfc822 format available.

Notification sent to Tomas Volf <~@wolfsden.cz>:
bug acknowledged by developer. (Wed, 20 Nov 2024 22:42:01 GMT) Full text and rfc822 format available.

Message #16 received at 71676-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tomas Volf <~@wolfsden.cz>
Cc: 71676-done <at> debbugs.gnu.org, Florian Pelz <pelzflorian <at> pelzflorian.de>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#71676] [PATCH v3] services: nginx-upstream-configuration:
 Allow file-like objects
Date: Wed, 20 Nov 2024 23:41:17 +0100
Tomas Volf <~@wolfsden.cz> 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!




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 19 Dec 2024 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 84 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.