From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id WK3bD6pStGKYOQEAbAwnHQ (envelope-from ) for ; Thu, 23 Jun 2022 13:46:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 0JCeD6pStGJLBgAAauVa8A (envelope-from ) for ; Thu, 23 Jun 2022 13:46:50 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D2D0039CEA for ; Thu, 23 Jun 2022 13:46:49 +0200 (CEST) Received: from localhost ([::1]:42560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4LIO-0003gr-Dl for larch@yhetil.org; Thu, 23 Jun 2022 07:46:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4LHe-0003fQ-Nx for guix-patches@gnu.org; Thu, 23 Jun 2022 07:46:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4LHe-0003ZC-FW for guix-patches@gnu.org; Thu, 23 Jun 2022 07:46:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o4LHe-0008Un-90 for guix-patches@gnu.org; Thu, 23 Jun 2022 07:46:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56164] [PATCH] services: nginx: Add support for extra content in upstream blocks. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Jun 2022 11:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56164 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56164@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165598471132593 (code B ref -1); Thu, 23 Jun 2022 11:46:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Jun 2022 11:45:11 +0000 Received: from localhost ([127.0.0.1]:37632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4LGp-0008Tc-EW for submit@debbugs.gnu.org; Thu, 23 Jun 2022 07:45:11 -0400 Received: from lists.gnu.org ([209.51.188.17]:49706) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4LGm-0008TQ-JY for submit@debbugs.gnu.org; Thu, 23 Jun 2022 07:45:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4LGm-0003OX-8C for guix-patches@gnu.org; Thu, 23 Jun 2022 07:45:08 -0400 Received: from mira.cbaines.net ([212.71.252.8]:36420) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4LGh-0003Dl-Ov for guix-patches@gnu.org; Thu, 23 Jun 2022 07:45:06 -0400 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:54d1:d5d4:280e:f699]) by mira.cbaines.net (Postfix) with ESMTPSA id 9C17C27BBE9 for ; Thu, 23 Jun 2022 12:45:01 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 86010773 for ; Thu, 23 Jun 2022 11:45:00 +0000 (UTC) From: Christopher Baines Date: Thu, 23 Jun 2022 12:45:00 +0100 Message-Id: <20220623114500.13409-1-mail@cbaines.net> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=212.71.252.8; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1655984810; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xjRzQx7q7i3rt7vSqZjmCn50CS8oQOlhSe6b20Y7DzA=; b=knYAKYVTmXxV0YcTdggXKU+8jld1j4NciOjBIvH8jgcxevY2xzihGvVqojQ/3mVBeqpO08 kCV9L9pUaOTQaJNDHJ2YP+++Z8tWinQdPu9v/YAWksWzDgfDz84ML5OdAf2VRCT/DFyKpH pS/5Y5T37cfVhLDFyCHPXrV4kcwRiIDnnqAhHilz60si8wa8lw/QVXSTSz0Pkj3A2dmVfS 63mTaRdFL9bZYEhYznGjt/H6aOIimDULO0bo8Z5OOsk3YOUDx90Iw8/ytc+QR7Bia+yMH3 TgtTe2OwHuBR1vjUFgv1PN6ThmtMK5c3CJSgQj8jDzhVrzO5K39Gje8/5lqkTg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1655984810; a=rsa-sha256; cv=none; b=jEMLbuqdRNQ06Z0GzpEJdsf/rqpFT300bu6sdIlZv8QmS0ILV/HDPvgo5t7EoY2hzBy+LG SrtNW86KTD3wFyeQ2Yf26kUMwn0KD36oD/e1iSiRxU3LQ+YsmGGYwdHVUQxkDMLm+yk4Fp WcIY4CmQzIyQr0I4SN6P/Y04CJhuYb/mycXnS0ZgWFOUQsjVNpCbJvIBWl/+cbDDdnBdIk uABf4DQdXyno405rf6wOIGON6xmleACTlOR1JkzJolJaT+cD4nc2EktBpoB9X6PP7YDRIA 4DKJEwVmz1akU8tbB/qQHVuUmvoBryDOVWAAl7y7QhG0rA6uvEBqGrGckoWphw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.66 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: D2D0039CEA X-Spam-Score: -1.66 X-Migadu-Scanner: scn1.migadu.com X-TUID: Npq+Jir+pwso I'm looking at this as I'd like to use the keepalive functionality. * gnu/services/web.scm (nginx-upstream-configuration-extra-content): New procedure. (emit-nginx-upstream-config): Include the extra-content if applicable. * doc/guix.texi (NGINX): Document this. --- doc/guix.texi | 3 +++ gnu/services/web.scm | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index bbb7d0764d..0a96ad1852 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -28490,6 +28490,9 @@ prefix @samp{unix:}. For addresses using an IP address or domain name, the default port is 80, and a different port can be specified explicitly. +@item @code{extra-content} +A string or list of strings to add to the upstream block. + @end table @end deftp diff --git a/gnu/services/web.scm b/gnu/services/web.scm index 4f06d4e0bb..4434fecf02 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -120,6 +120,7 @@ (define-module (gnu services web) nginx-upstream-configuration? nginx-upstream-configuration-name nginx-upstream-configuration-servers + nginx-upstream-configuration-extra-content nginx-location-configuration nginx-location-configuration? @@ -517,7 +518,9 @@ (define-record-type* nginx-upstream-configuration make-nginx-upstream-configuration nginx-upstream-configuration? (name nginx-upstream-configuration-name) - (servers nginx-upstream-configuration-servers)) + (servers nginx-upstream-configuration-servers) + (extra-content nginx-upstream-configuration-extra-content + (default '()))) (define-record-type* nginx-location-configuration make-nginx-location-configuration @@ -643,6 +646,15 @@ (define (emit-nginx-upstream-config upstream) (map (lambda (server) (simple-format #f " server ~A;\n" server)) (nginx-upstream-configuration-servers upstream)) + (let ((extra-content + (nginx-upstream-configuration-extra-content upstream))) + (if (and extra-content (not (null? extra-content))) + (cons + "\n" + (map (lambda (line) + (simple-format #f " ~A\n" line)) + (flatten extra-content))) + '())) " }\n")) (define (flatten . lst) -- 2.36.1