diff mbox series

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

Message ID d29be842564f1d0e0e62bcc3aa46921a5e0a6a8f.1718822958.git.richard@freakingpenguin.com
State New
Headers show
Series [bug#71586,v2] services: web: Improve nginx formatting for extra-content | expand

Commit Message

Richard Sent June 19, 2024, 6:49 p.m. UTC
* 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(-)


base-commit: e32e3d0a03dc17c4c54a91aad053c9036998b601
diff mbox series

Patch

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