From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id OKNfBmmQdGYNBgAAqHPOHw:P1 (envelope-from ) for ; Thu, 20 Jun 2024 20:26:17 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id OKNfBmmQdGYNBgAAqHPOHw (envelope-from ) for ; Thu, 20 Jun 2024 22:26:17 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=rK8KscAp; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b="YCzoQ/aE"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=wolfsden.cz (policy=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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1718915177; 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=Fm6wZOdz/10nImj/mqqCanDc1KWufgxHPKGQyXDKoOA=; b=XEOBd8kb9pN6NLbrUeU0cVv/uJfcmOE4hXtSSZfJAGyQeNrz6iKudkFZBafmFtkWcc/2sc 9fBphKPMiwSEEZinutI1g+X946eiWt2gZU1HnnWk6rWoiEWtA7qAfkk3LpKoRVQ5Id4zdd oAlgVfbb4rKe2dKKZC0E4kdKb4+wlnex9VcljtPZM8IbF5Q1zUv3hsUidQAmCRv5SokrS8 TQt0qA1OghognNlFusw14sgmkJ0Lv8OdK8wky53207gW7zL+X126QXcNn9vDQvj6txkj23 +awhb9pK1U71H1M0Iio/xFr4HStGrfKu+ak+xmFxvXRUL1mCnjOvebyU9+qpQw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1718915177; a=rsa-sha256; cv=none; b=dwzuWHotjE9bVkD4P1BcGfP7PQr1LzvYCwx6QUhdm4k1+XWe93JZdV7Q3jWX6yhewXccjs ZedtkxmRqu52wM/p27VA82nLv5L/qdzZvCx8jvWvhDJbd927YorX1hzc+vpWkfOs+LTBuB rRbt5Vj8C6TLZW64ZT1Npl5Mrstc7bP2zCaanwdyMPX3DkpyozOPWPVvobogOXi8O0uvxR jw+ukRMHBJekyXW2VXqjqylmGCO2pB17j0Ef2dNLYTh7YcGeUbfHBF8yPi+bXyMWiDENJ1 uG6nrZ6feQqmel6Irzp464dhY/kU2jnncGUyyPjP9LuFJ9LzUErIpVIA+bvScw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=rK8KscAp; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b="YCzoQ/aE"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=wolfsden.cz (policy=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" 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 5A32A68DB2 for ; Thu, 20 Jun 2024 22:26:15 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKOMC-0008Qa-C5; Thu, 20 Jun 2024 16:26:08 -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 1sKOM6-0008Od-3z for guix-patches@gnu.org; Thu, 20 Jun 2024 16:26:03 -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 1sKOM4-0006Gs-Fv; Thu, 20 Jun 2024 16:26:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sKOM6-0003WT-Cm; Thu, 20 Jun 2024 16:26:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71676] [PATCH v2] 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, matt@excalamus.com, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Thu, 20 Jun 2024 20:26: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?= , Matthew Trzcinski , Maxim Cournoyer X-Debbugs-Original-Xcc: Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer Received: via spool by 71676-submit@debbugs.gnu.org id=B71676.171891510313439 (code B ref 71676); Thu, 20 Jun 2024 20:26:02 +0000 Received: (at 71676) by debbugs.gnu.org; 20 Jun 2024 20:25:03 +0000 Received: from localhost ([127.0.0.1]:43043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKOL9-0003Ug-HC for submit@debbugs.gnu.org; Thu, 20 Jun 2024 16:25:03 -0400 Received: from wolfsden.cz ([37.205.8.62]:42844) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1sKOL6-0003UB-Hk for 71676@debbugs.gnu.org; Thu, 20 Jun 2024 16:25:02 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id B750129DE60; Thu, 20 Jun 2024 20:24:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1718915094; bh=o7pKrvHsIHyqvga/rkzxIMAY5tryZIcwf3ByeAlYmXQ=; h=From:To:Cc:Subject:Date; b=rK8KscApBZuvsDmGssh91UZ9iMaDmrOcdqu7MWVeorOteq9zZd9sRCenSLD4CzTbb IDeIphn5VQ2yy/t9BqUqMIPc3C5q58zAs0I/yYhR6D1xLpbbxhze3V/VkdUUNbqzkx 1w0LesSM6Ne2RyoxT/ZtrD9osBoVvIz0kjZZeWJHL1oImjRwvkPyznCWavegLNZ26l TQ2v6kTJfhd28z2xe4Wq3vq/nZuLucwNc1FX43HMucIpMHLMns7XqALgTbspHnpR76 6pC3esfJFWhdo1yfP4AeeQfJO37BxkthWp8ox9CTlfBsb9xZOGIb7aHKvukVw+6LDi lzJFlcAHwqKHZKqia+UouqrTA752SS4RXUwct3pSXYjLXbO9OauQBm6rpc80tGuMu5 Zluay7GTeENQP81cWYiKZ8GClXlJBVUcshvfXQxrgjItSVx1jpit55dWzNPBbp5+/2 biMf+vwW+YaHan91vOmdKSpdWLtrTbiFj8o3QSNG5+jtSrR/EfEr+jvT+27hWYd+I+ fcYgrVTmJLJ00I0+rK7SiW/L81IXVplaqr7aOdPpeboUQtZPrVW4a5LsCgcPFjh9FV JIVPfQK/vCADQFtlPuYfsne+j4B8EChI4VNtGhonZejgZy5ZFMJWM8zzB6iEkG/vXu hleojZO4uYWcfKBxVPUzB10U= Received: from localhost (unknown [146.70.134.164]) by wolfsden.cz (Postfix) with ESMTPSA id 7CA3929CADB; Thu, 20 Jun 2024 20:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1718915093; bh=o7pKrvHsIHyqvga/rkzxIMAY5tryZIcwf3ByeAlYmXQ=; h=From:To:Cc:Subject:Date; b=YCzoQ/aEOl50jS1R1CZJ75cnKKskV8BH8LZIvGvXpzbosoXw0OHYBlXFGsoPulFKs oOSacPTLnrs7ZDZ8F5a5ZdyWSNmvAVsM063l/rouo7mBt6KrY9V1IMDLLhf0JJT1ku p4dNXa1piHLTGNxrnxLyb5H8SsoEyGGaYR4SacBQa9JLzYcxjFjsYsuxsxDKEb9T0G Y0FphxMIVJDOhCxdrSbX6d3Xr6JyUeopTcwqOy59ERCdvLEC4wVcUZpdJA1j3IB2fp GOqB56PfjKlnLcSRn9LQJdIymg31T1Vr8nkPvjbWxruXqXhdWznsdNj1Yge+8n7hXF +wjDUhSuDXPdd2EX5/gTLIOVDTX8d5NWle3DNI93IA3/xXT8K8l4cyn75KB4+/trV/ HzF5POrwlI9y1Sxj0qBuBmsuJb8GNsYYSUIsT8z8yLgdVOU+IXMU2WjuFFW3y9lo16 wcG2+e+BNsfiHkT0RcRysRGKrG3Nzz3/5GrH+63OiG728Iz4GCl+BRbBzNsSxyIoXj L48R4xxct7hGDtHRyRdYasf3h2WZp01QPPnViVQpiLUDRSIt3Hidk3DqUexKit1vQy 4q7K2weoGif3cOwH/z8yksrjtGdVxiaVagK2zLPwsnr4RpxaSGUzZireRIrTjun6FM fC6p1KT0yrvqXTMX/4DC23BI= From: Tomas Volf <~@wolfsden.cz> Date: Thu, 20 Jun 2024 22:23:04 +0200 Message-ID: X-Mailer: git-send-email 2.45.1 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 5A32A68DB2 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -2.26 X-Spam-Score: -2.26 X-TUID: Xli02/8rlOD9 * 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. 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 55710dc968..f6f2788ed2 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -32095,7 +32095,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 340988fdd8..8d81c926e8 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -701,8 +701,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.45.1