From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id GGDpB6OrAme3WQEA62LTzQ:P1 (envelope-from ) for ; Sun, 06 Oct 2024 15:24:19 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id GGDpB6OrAme3WQEA62LTzQ (envelope-from ) for ; Sun, 06 Oct 2024 17:24:19 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=S9DNK1cX; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=BGbSmsuA; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=BGbSmsuA; 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"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=wolfsden.cz (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1728228259; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ydrK8MNWkL2ZaDvbzJnjbjjQK9AbglSkxPxX6OG23X4=; b=ZASxu3kGDY1t1/Y5f1Vbsew8XHxwr+uLusUcUdywMqNYGHRkX9dTZmdRxE1aeA1tjpk94T Q4L0mOs7icRKrlocx8vH9z8mrHGCEQhcBrZAh4TkDV0IrqvS7B3mDGO1J6M8MfuTRZ+Fe6 p2kXv0cHaojVi3rrJZmrrQvM8LMJkTXIsR3JtFLmg096Cb9yzLPZtQTN+exsZ04Inev0rd 3+pbtHZ8TbKOpzn2p65u4qKOB87kkSB+8iIKuq7PPqCEfNWwVKWYt3j3NsRMxyA58++7Wc kmo+fKObh5CXg4GWYaHPmFnTDjWJHrbbY5TeXb3bumE6/+lVH2uCNc6wNQa3fQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=S9DNK1cX; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=BGbSmsuA; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=BGbSmsuA; 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"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=wolfsden.cz (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1728228259; a=rsa-sha256; cv=none; b=lcUGyOWjlwDX4e1ksu37WRp/CwzTLoV2SupCXymtZPmAYB5vx+QjB3PIejQT1iTuvZ619t NVJiig0visBugqLsVmHJ23i52KcG7fdTTiQ1GkulZJNfoNqwdeDnVvu/7OVi2aK7snb211 EKwjdN/k7ALICsUbTRTCRbPUENoNjICP0IbTLnQg8ItOXQIjUmu/CGXYrOMLDKQmHxDk49 YCP2PoFWourFMb8cqP28QBGq8bo8/LIZRyR2szQaFjcfQT01gPukQRSfLen8Y9k2foGl0a 0dn4yNW/H5ZLWSPeAmfiJDErv88XJI98gCnbx5UoMdazWI+eYtKXj5LFMN5mSA== 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 8D8AB84AB3 for ; Sun, 06 Oct 2024 17:24:18 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sxT72-0004A6-Ck; Sun, 06 Oct 2024 11:24:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sxT70-00049j-Vu for guix-patches@gnu.org; Sun, 06 Oct 2024 11:23:59 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sxT6z-0000D7-A6; Sun, 06 Oct 2024 11:23:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=ydrK8MNWkL2ZaDvbzJnjbjjQK9AbglSkxPxX6OG23X4=; b=S9DNK1cXRbGYhjCeBfp3L1sN2SQ7n/cOpzUmxO8YEl+me7AGObQJCrCqkf29TDkDOUFQFgxDVRxpnhd+HWmt6H8xax0xbCQi+HIohyWYd7G+3RmiPp+yvLj33hKG6dwaOfNV56Eq7ESwiH5vMvQ4+wKWn3dLrwFvL8WlC4HvBy4WsB8fc1TJN4IIXRf1Y/HgEVPt673HXb+AAFkU8Dy4CeUtjJH9NUFd1zruwMG+fjbyTeQs9CYjzGLeBBY/FIUuBloAJsCx4I8BSU817QQT/hGbjgBdhqYwX9qnax5263Dlfu4u9wO5CggMhWDjY+n8HS5B2PJBWHiPxAXK8kAHCg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sxT74-0007jU-AO; Sun, 06 Oct 2024 11:24:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71676] [PATCH v3] services: nginx-upstream-configuration: Allow file-like objects References: In-Reply-To: Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: pelzflorian@pelzflorian.de, ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Sun, 06 Oct 2024 15:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71676 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71676@debbugs.gnu.org Cc: Tomas Volf <~@wolfsden.cz>, Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 71676-submit@debbugs.gnu.org id=B71676.172822821929685 (code B ref 71676); Sun, 06 Oct 2024 15:24:02 +0000 Received: (at 71676) by debbugs.gnu.org; 6 Oct 2024 15:23:39 +0000 Received: from localhost ([127.0.0.1]:41959 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sxT6h-0007ij-2B for submit@debbugs.gnu.org; Sun, 06 Oct 2024 11:23:39 -0400 Received: from wolfsden.cz ([37.205.8.62]:60396) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1sxT6d-0007iZ-O5 for 71676@debbugs.gnu.org; Sun, 06 Oct 2024 11:23:36 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 8F29931E83F; Sun, 6 Oct 2024 15:23:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1728228208; bh=sTV4B01rkQVLbRgeBwaBGyYCMsFYJcWCgvl8IFelblg=; h=From:To:Cc:Subject:Date; b=BGbSmsuAvt0MigDEvBMMd6DFJlbM2AeDno4iZdyOiYT3YhtpUDTaWJziDx0CRLWcC vQf7titfRRq34jW2QUVOOvz7mnb7pRRdPurmkx2iibrEKOZnmnFxrWNWLn18L//3Cr XSUWaqLE2Cd9+jV4Ek2L1KrUooz9ip5bRTAoiJp62lb8mvr7F4J73C/Z9OqH7dz0i0 rn3HaEwzMNIcBMVLGYcai0vbp3q64fCHb/xlmFZbWfW9BRJ6B16CsW0g6XVkBhIX30 Jey9KQb2L4Ai/5lpTixoJXPD+VWVwVdFLKTeRrC08o7Rgm2AqjB8Zh10ly3QXKbmhC ztCOGM6eNCw3kHhXaXJ8SwqCcdGE2mH/N9w6nZuLIj2hap0Ueig1dExbzMueFbasxV OVnZtm5cB0mSWikxgKmMlmMxqvFlC66N+lLotHdlFMWS0l4jUvr9S5/7xoiHwPOz2v b9LlRLbIrhTCfjbQUPn177yeqFNu79c8/ezzIxhbJevMwRd9YNLSoHA4cGFJHHwBQe Jhpg4X/Jc7NVOroGms+9PvEW/6MuRFqi5EtoCLMt8sjZeDgMIfORiK/Hr4D9JWYnVf 8g1HjZ336XU2gn3pxDJkc9PonRaST9JfHG5UHxixQVyUkxjeYrD3DNrPzty5NBdgSe SF8JQ0SLgKGar8j864h4C6Qs= Received: from localhost (unknown [146.70.134.132]) by wolfsden.cz (Postfix) with ESMTPSA id 2F60031DFCB; Sun, 6 Oct 2024 15:23:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1728228208; bh=sTV4B01rkQVLbRgeBwaBGyYCMsFYJcWCgvl8IFelblg=; h=From:To:Cc:Subject:Date; b=BGbSmsuAvt0MigDEvBMMd6DFJlbM2AeDno4iZdyOiYT3YhtpUDTaWJziDx0CRLWcC vQf7titfRRq34jW2QUVOOvz7mnb7pRRdPurmkx2iibrEKOZnmnFxrWNWLn18L//3Cr XSUWaqLE2Cd9+jV4Ek2L1KrUooz9ip5bRTAoiJp62lb8mvr7F4J73C/Z9OqH7dz0i0 rn3HaEwzMNIcBMVLGYcai0vbp3q64fCHb/xlmFZbWfW9BRJ6B16CsW0g6XVkBhIX30 Jey9KQb2L4Ai/5lpTixoJXPD+VWVwVdFLKTeRrC08o7Rgm2AqjB8Zh10ly3QXKbmhC ztCOGM6eNCw3kHhXaXJ8SwqCcdGE2mH/N9w6nZuLIj2hap0Ueig1dExbzMueFbasxV OVnZtm5cB0mSWikxgKmMlmMxqvFlC66N+lLotHdlFMWS0l4jUvr9S5/7xoiHwPOz2v b9LlRLbIrhTCfjbQUPn177yeqFNu79c8/ezzIxhbJevMwRd9YNLSoHA4cGFJHHwBQe Jhpg4X/Jc7NVOroGms+9PvEW/6MuRFqi5EtoCLMt8sjZeDgMIfORiK/Hr4D9JWYnVf 8g1HjZ336XU2gn3pxDJkc9PonRaST9JfHG5UHxixQVyUkxjeYrD3DNrPzty5NBdgSe SF8JQ0SLgKGar8j864h4C6Qs= From: Tomas Volf <~@wolfsden.cz> Date: Sun, 6 Oct 2024 17:22:57 +0200 Message-ID: <734857b0ef0cc747f01f5cd45f6776fce89a9e64.1728228177.git.~@wolfsden.cz> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: 5.99 X-Spam-Score: 5.99 X-Migadu-Queue-Id: 8D8AB84AB3 X-TUID: Q5zdq1CnfUlg * gnu/services/web.scm (emit-nginx-upstream-config): Support file-like objects. * doc/guix.texi (Web Services)[nginx-upstream-configuration]: Document it. Change-Id: I49996e358174dc77b31e3c91b908a6a72f3eb705 --- v2: Keep support for plain string or file-like object. I did not realize that flatten also accepts non-lists and wraps them in a list. v3: Rebase on latest master. doc/guix.texi | 11 ++++++++++- gnu/services/web.scm | 6 ++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 52e36e4354..b45b7c2c93 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -32229,7 +32229,16 @@ Web Services explicitly. @item @code{extra-content} -A string or list of strings to add to the upstream block. +Additional content to be appended to the upstream block. Can be a +string or file-like object or list of thereof. In case of list, each +item is prefixed with indentation and suffixed with a new line. Nested +lists are flattened. + +@lisp +(extra-content "include /etc/nginx/custom-config.conf;") +(extra-content `("include /etc/nginx/custom-config.conf;" + ("include " ,%custom-config.conf ";"))) +@end lisp @end table @end deftp diff --git a/gnu/services/web.scm b/gnu/services/web.scm index cc6f4e6d9b..39c0035405 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -703,8 +703,10 @@ (define (emit-nginx-upstream-config upstream) (cons "\n" (map (lambda (line) - (simple-format #f " ~A\n" line)) - (flatten extra-content))) + `(" " ,line "\n")) + (if (list? extra-content) + extra-content + (list extra-content)))) '())) " }\n")) -- 2.46.0