From patchwork Tue Jul 26 13:06:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tiantian X-Patchwork-Id: 41003 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D4A4F27BBEB; Tue, 26 Jul 2022 16:58:37 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2E25527BBEA for ; Tue, 26 Jul 2022 16:58:36 +0100 (BST) Received: from localhost ([::1]:59902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGMx9-0001u1-Ai for patchwork@mira.cbaines.net; Tue, 26 Jul 2022 11:58:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGMVW-0004Gf-T6 for guix-patches@gnu.org; Tue, 26 Jul 2022 11:30:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36222) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGMVW-0007X8-J3 for guix-patches@gnu.org; Tue, 26 Jul 2022 11:30:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oGMVW-0005Pu-EV for guix-patches@gnu.org; Tue, 26 Jul 2022 11:30:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56783] [PATCH] services: nginx: Add support for extra content before server blocks. Resent-From: typ22@foxmail.com Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 26 Jul 2022 15:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56783 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56783@debbugs.gnu.org Cc: tiantian X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165884939420760 (code B ref -1); Tue, 26 Jul 2022 15:30:02 +0000 Received: (at submit) by debbugs.gnu.org; 26 Jul 2022 15:29:54 +0000 Received: from localhost ([127.0.0.1]:54203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGMVJ-0005OZ-Cf for submit@debbugs.gnu.org; Tue, 26 Jul 2022 11:29:54 -0400 Received: from lists.gnu.org ([209.51.188.17]:34748) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGKIf-0006iD-K2 for submit@debbugs.gnu.org; Tue, 26 Jul 2022 09:08:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGKIe-0005sE-UD for guix-patches@gnu.org; Tue, 26 Jul 2022 09:08:37 -0400 Received: from out162-62-57-210.mail.qq.com ([162.62.57.210]:44105) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGKIW-00008m-Hr for guix-patches@gnu.org; Tue, 26 Jul 2022 09:08:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1658840895; bh=16POmHzLZGTV9RbULOmzvyhJ6qFn54i8S9vzWnhEj+E=; h=From:To:Cc:Subject:Date; b=gl80PxtgkVDhefLe3eoRb48T+R5EcdI74oQ8ILUMpLKjMuds/4VD3gusBxaFluisk C9HuzfNf1x7csUj8b1a+FORLMQ2bF7Se9oFPI2tb3H8wG5vWm+07v7GxCt0hLhnHln sP4rYmG5rcUZLhmgwXxcThxDXVX7TNocR+QTJzD8= Received: from tt-arch.localdomain ([240e:398:28a7:e711:47ea:6145:f832:d560]) by newxmesmtplogicsvrsza30.qq.com (NewEsmtp) with SMTP id 1C3A0076; Tue, 26 Jul 2022 21:07:03 +0800 X-QQ-mid: xmsmtpt1658840823ta93p3o8d Message-ID: X-QQ-XMAILINFO: MFWpArBVhhGTF9nJvQwdUH68M2FanVIFpQLpyRzIsrajFegu0J9qagSfDgHsW9 M3qwpeTmLWqIZt95dZlYXl5qL56OXjUcOX9eTNrn/8z3b/1c3MJ8CVCloNddIVJ5S10EGsXjJnZt wOkVgBnloJ8iZ/Lkm4I+xM93eKSF/EhKNgSVare9U14o5mQ6WcUCyIJHVaAKTLYNHuWKeE5SJoxA C5vvpYZiqne3jhaKmDUB9mNIaHhNn4aE6BRIeWgsolhqVBPKbiL+yQHFcwu7DjfYOXI9jAzZPRg1 5324TUXn8zJbRT6Mo7VUsIYUszYfUvThAXEs5Wtp7nw5AtMYbW0rLxHhB6IiZ0LO920OwP+vlAu+ d3nUv4BpUc566ZgSUbEc0LsE/J9XrcOSTxUNDVjDwjZ31MT1YK1l6WR93fytoygO5TaKmJXT9mL0 pIcZNefx/N23qKGQgV8H7xHJ4uGKv6ntNpH/Yt7usCbOyEoSPwUI98pcxjY+foZWI0EFNh64WTxz 7hHDtanyTD4nQaylff/A2EXCnUSBt47i2lbTzBb5rRXBetSIliBeKawwEDzo3FU7CvptyCadeZpy aYfAJ1NHHO+Mxmj3qx2elFSUnlFTzP4cwxdsHS06U+3IQyjc2zuZtPxyqLk4MFKfLUIouGsQBGlU 4rcaKl4HYSBL4jGZ4c9C39vk9A0wZzKXXdAJW05qA9PWrH+gAfVsvTvl+c80lQ0TM6eTVSZPTElN jN7drgFUw2lDGkwTwWhYTi431dA9RyHoGWmHFJ9NHC32Xl6HEsMejzt2U+um++RF/OovTdyrUlRx oHslzJBWODtfBaisdjvZqHR6TJQEnZsVUGLbWHGXYKNenQ/5NL/Af0rx9C5UN5jjE+gQt9Y/wMif vXAB/40zGBb01p0ULSdeptyC9W204NFunKn3h0/pSdJW/n7LVrKSEetxKiLSHGrOq9gCsfsdwUcb j4xDzXWX4= From: typ22@foxmail.com Date: Tue, 26 Jul 2022 21:06:07 +0800 X-OQ-MSGID: X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Received-SPF: pass client-ip=162.62.57.210; envelope-from=typ22@foxmail.com; helo=out162-62-57-210.mail.qq.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HELO_DYNAMIC_IPADDR=1.951, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 26 Jul 2022 11:29:47 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Tue, 26 Jul 2022 11:58:24 -0400 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches From: tiantian 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* (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