* [bug#71676] [PATCH] services: nginx-upstream-configuration: Allow file-like objects
@ 2024-06-20 13:04 Tomas Volf
2024-06-20 20:23 ` [bug#71676] [PATCH v2] " Tomas Volf
2024-10-06 15:22 ` [bug#71676] [PATCH v3] " Tomas Volf
0 siblings, 2 replies; 4+ messages in thread
From: Tomas Volf @ 2024-06-20 13:04 UTC (permalink / raw)
To: 71676
Cc: Tomas Volf, Florian Pelz, Ludovic Courtès, Matthew Trzcinski,
Maxim Cournoyer
* 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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [bug#71676] [PATCH v2] services: nginx-upstream-configuration: Allow file-like objects
2024-06-20 13:04 [bug#71676] [PATCH] services: nginx-upstream-configuration: Allow file-like objects Tomas Volf
@ 2024-06-20 20:23 ` Tomas Volf
2024-10-06 15:22 ` [bug#71676] [PATCH v3] " Tomas Volf
1 sibling, 0 replies; 4+ messages in thread
From: Tomas Volf @ 2024-06-20 20:23 UTC (permalink / raw)
To: 71676
Cc: Tomas Volf, Florian Pelz, Ludovic Courtès, Matthew Trzcinski,
Maxim Cournoyer
* 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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [bug#71676] [PATCH v3] services: nginx-upstream-configuration: Allow file-like objects
2024-06-20 13:04 [bug#71676] [PATCH] services: nginx-upstream-configuration: Allow file-like objects Tomas Volf
2024-06-20 20:23 ` [bug#71676] [PATCH v2] " Tomas Volf
@ 2024-10-06 15:22 ` Tomas Volf
2024-11-20 22:41 ` bug#71676: " Ludovic Courtès
1 sibling, 1 reply; 4+ messages in thread
From: Tomas Volf @ 2024-10-06 15:22 UTC (permalink / raw)
To: 71676; +Cc: Tomas Volf, Florian Pelz, Ludovic Courtès, Maxim Cournoyer
* 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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#71676: [PATCH v3] services: nginx-upstream-configuration: Allow file-like objects
2024-10-06 15:22 ` [bug#71676] [PATCH v3] " Tomas Volf
@ 2024-11-20 22:41 ` Ludovic Courtès
0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2024-11-20 22:41 UTC (permalink / raw)
To: Tomas Volf; +Cc: 71676-done, Florian Pelz, Maxim Cournoyer
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!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-20 22:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-20 13:04 [bug#71676] [PATCH] services: nginx-upstream-configuration: Allow file-like objects Tomas Volf
2024-06-20 20:23 ` [bug#71676] [PATCH v2] " Tomas Volf
2024-10-06 15:22 ` [bug#71676] [PATCH v3] " Tomas Volf
2024-11-20 22:41 ` bug#71676: " Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).