diff mbox series

[bug#71673,v2] services: nginx: Print extra-content before the server-blocks.

Message ID e3157a86723b2f74fe7ab16465c12e4668ccce33.1728229214.git.~@wolfsden.cz
State New
Headers show
Series [bug#71673,v2] services: nginx: Print extra-content before the server-blocks. | expand

Commit Message

Tomas Volf Oct. 6, 2024, 3:40 p.m. UTC
The configuration file is processed sequentially, which meant that there was
no way to set for example log format shared between the server-blocks, because
the final configuration file would have this order:

  ...
  http {
    ...
    server {
    }
    ...
    $extra-content
  }

Moving the extra-content before the serialization of server-blocks resolves
this.

* gnu/services/web.scm (default-nginx-config): Move extra-content before
server-blocks.

Change-Id: Ie8286a533dfed575abc58a0f4800706b3ad6adc2
---
Rebase on latest master.

 gnu/services/web.scm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--
2.46.0
diff mbox series

Patch

diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index cc6f4e6d9b..84ce88aa80 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -770,10 +770,7 @@  (define (default-nginx-config config)
                 (number->string server-names-hash-bucket-max-size)
                 ";\n")
                "")
-           "\n"
-           (map emit-nginx-upstream-config upstream-blocks)
-           (map emit-nginx-server-config server-blocks)
-           (match extra-content
+	   (match extra-content
              ((? list? extra-content)
               (map (lambda (line)
                      `("    " ,line "\n"))
@@ -781,7 +778,10 @@  (define (default-nginx-config config)
              ;; XXX: For compatibility strings and gexp's are inserted
              ;; directly.
              (_ extra-content))
-           "\n}\n"))))
+           "\n"
+           (map emit-nginx-upstream-config upstream-blocks)
+           (map emit-nginx-server-config server-blocks)
+           "}\n"))))

 (define %nginx-accounts
   (list (user-group (name "nginx") (system? #t))