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 +++++++++++++++++ guix/forge/tissue.scm | 18 +----------------- 2 files changed, 18 insertions(+), 17 deletions(-) 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}." diff --git a/guix/forge/tissue.scm b/guix/forge/tissue.scm index 1608728..abf3e39 100644 --- a/guix/forge/tissue.scm +++ b/guix/forge/tissue.scm @@ -248,22 +248,6 @@ #:log-file "/var/log/tissue.log"))) (stop #~(make-kill-destructor))))) -(define (socket->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 (tissue-nginx-server-blocks config) "Return list of @code{} extensions for tissue configuration @var{config}." @@ -286,7 +270,7 @@ tissue configuration @var{config}." (locations (cons (nginx-location-configuration (uri "@tissue-search") - (body (list (socket->proxy-pass socket) + (body (list (socket->nginx-proxy-pass socket) "proxy_set_header Host $host;"))) (append (map (cut project->location state-directory <>) projects) -- cgit 1.4.1