Subject: [bug#71586] [PATCH v2] services: web: Improve nginx formatting for extra-content

From: Richard Sent <[email-masked]>
Date: Wed, 19 Jun 2024 14:49:19 -0400

* gnu/services/web (default-nginx-config): When extra-content is a list, add 4
space indentation and a newline to every line. If it's a string, continue
inserting it directly. This makes the list serialization behavior more
consistent with other services.

Change-Id: Iec8614ba3cfc37292a566197e8d39b352b04846a
---

Updated according to feedback. I agree that file-like objects should
be lowered into strings like they normally are and not serialized in
their package form.

emit-nginx-upstream-config has a similar issue.

 gnu/services/web.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 406117c457..0572af1310 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -771,7 +771,12 @@ (define (default-nginx-config config)
            "\n"
            (map emit-nginx-upstream-config upstream-blocks)
            (map emit-nginx-server-config server-blocks)
-           extra-content
+           (match extra-content
+             ((? string? extra-content) extra-content)
+             ((? list? extra-content)
+              (map (lambda (line)
+                     `("    " ,line "\n"))
+                   extra-content)))
            "\n}\n"))))
 
 (define %nginx-accounts

base-commit: e32e3d0a03dc17c4c54a91aad053c9036998b601
-- 
2.45.1