From 4fb5ad671312091e10eff831600dab1b5cd4a6dd Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 9 Nov 2025 11:51:37 +0000 Subject: nginx: Move socket->proxy-pass to (forge nginx). --- guix/forge/nginx.scm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'guix/forge/nginx.scm') diff --git a/guix/forge/nginx.scm b/guix/forge/nginx.scm index c932187..2e22bd8 100644 --- a/guix/forge/nginx.scm +++ b/guix/forge/nginx.scm @@ -36,6 +36,7 @@ forge-nginx-configuration-acme-challenge-directory forge-nginx-configuration-server-blocks nginx-socket->string + socket->nginx-proxy-pass forge-nginx-service-type)) (define-record-type* @@ -72,6 +73,22 @@ configuration (for example, in the @code{listen} and (($ path) (string-append "unix:" path)))) +(define (socket->nginx-proxy-pass socket) + "Serialize @var{socket}, a forge socket, to an nginx @code{proxy_pass} +directive." + (string-append + "proxy_pass " + (match socket + (($ hostname port) + (string-append "http://" hostname ":" (number->string port))) + (($ (? ipv4-address? ip) port) + (string-append "http://" ip ":" (number->string port))) + (($ (? ipv6-address? ip) port) + (string-append "http://[" ip "]:" (number->string port))) + (($ path) + (string-append "http://unix:" path ":"))) + ";")) + (define (forge-nginx-server-blocks config) "Return list of nginx server blocks to provision for forge-web service specified by @var{config}." -- cgit 1.4.1