[PATCH] services: nginx: Print extra-content before the server-blocks.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Tomas Volf
Owner
unassigned
Submitted by
Tomas Volf
Severity
normal

Debbugs page

Tomas Volf wrote 9 months ago
(address . guix-patches@gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
fd941dd1a6549e891f4afa3293a1f262350e0fa9.1718882088.git.~@wolfsden.cz
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
---
While this I assume *could* be considered a backwards incompatible change, I
cannot really think of anything that it would break.

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

Toggle diff (18 lines)
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 406117c457..e3887d0ed8 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -768,11 +768,11 @@ (define (default-nginx-config config)
(number->string server-names-hash-bucket-max-size)
";\n")
"")
+ extra-content
"\n"
(map emit-nginx-upstream-config upstream-blocks)
(map emit-nginx-server-config server-blocks)
- extra-content
- "\n}\n"))))
+ "}\n"))))

(define %nginx-accounts
(list (user-group (name "nginx") (system? #t))
--
2.45.1
Tomas Volf wrote 5 months ago
[PATCH v2] services: nginx: Print extra-content before the server-blocks.
(address . 71673@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
e3157a86723b2f74fe7ab16465c12e4668ccce33.1728229214.git.~@wolfsden.cz
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(-)

Toggle diff (28 lines)
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))
--
2.46.0
Ludovic Courtès wrote 4 months ago
(name . Tomas Volf)(address . ~@wolfsden.cz)(address . 71673-done@debbugs.gnu.org)
87r075ttr7.fsf@gnu.org
Tomas Volf <~@wolfsden.cz> skribis:

Toggle quote (21 lines)
> 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

Applied, thanks!
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 71673@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 71673
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help