guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#56783] [PATCH] services: nginx: Add support for extra content befor


From: typ22
Subject: [bug#56783] [PATCH] services: nginx: Add support for extra content before server blocks.
Date: Tue, 26 Jul 2022 21:06:07 +0800

From: tiantian <typ22@foxmail.com>

Solve problems like log_format.

* gnu/services/web.scm (nginx-configuration-extra-content-ahead):
New procedure.
(nginx-configuration): Add the extra-content-ahead field.
(default-nginx-config): Include the extra-content-ahead.
* doc/guix.texi: Add document about extra-content-ahead.
---
 doc/guix.texi        | 3 +++
 gnu/services/web.scm | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 12ecc1b952..83cf86c8f4 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -28696,6 +28696,9 @@ Web Services
 Extra content for the @code{http} block.  Should be string or a string
 valued G-expression.
 
+@item @code{extra-content-ahead} (default: @code{""})
+Like extra-content, but it's located at upstream blocks and server blocks.
+
 @end table
 @end deffn
 
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index f0c7e90cbf..30f9688988 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -101,6 +101,7 @@ (define-module (gnu services web)
             nginx-configuration-server-names-hash-bucket-max-size
             nginx-configuration-modules
             nginx-configuration-global-directives
+            nginx-configuration-extra-content-ahead
             nginx-configuration-extra-content
             nginx-configuration-file
 
@@ -575,6 +576,8 @@ (define-record-type* <nginx-configuration>
                     (default #f))
   (lua-package-cpath nginx-lua-package-cpath ;list of file-like
                      (default #f))
+  (extra-content-ahead nginx-configuration-extra-content-ahead
+                 (default ""))
   (extra-content nginx-configuration-extra-content
                  (default ""))
   (file          nginx-configuration-file         ;#f | string | file-like
@@ -691,6 +694,7 @@ (define (default-nginx-config config)
                  global-directives
                  lua-package-path
                  lua-package-cpath
+                 extra-content-ahead
                  extra-content)
    (apply mixed-text-file "nginx.conf"
           (flatten
@@ -734,6 +738,8 @@ (define (default-nginx-config config)
                 ";\n")
                "")
            "\n"
+           extra-content-ahead
+           "\n"
            (map emit-nginx-upstream-config upstream-blocks)
            (map emit-nginx-server-config server-blocks)
            extra-content
-- 
2.37.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]