#!/@GUILE@ --no-auto-compile !# ;;; gn-guile-webserver --- the stripped branding webserver for ;;; aging.genenetwork.org. ;;; Copyright © 2026 Pjotr Prins ;;; ;;; Runs the (web webserver-aging) module. Used by the gn-guile ;;; container (gn-machines/genenetwork/containers/ ;;; gn-guile-container.scm); the package build substitutes @GUILE@ ;;; with the store guile and wraps the script with its load paths. (use-modules (ice-9 match)) (define (parse-port args) (let loop ((args args)) (match args (("--port" p . rest) p) (((? string->number p) . rest) p) ((_ . rest) (loop rest)) (() "8091")))) (define (main args) ;; TLS: the views fetch their markdown from raw.githubusercontent.com; ;; point guile/gnutls at the CA bundle (the package build wraps the ;; script with SSL_CERT_FILE from the system profile, but be safe if ;; run from a bare environment). (unless (getenv "SSL_CERT_FILE") (setenv "SSL_CERT_FILE" "/run/current-system/profile/etc/ssl/certs/ca-certificates.crt")) (unless (getenv "GUILE_TLS_CERTIFICATE_DIRECTORY") (setenv "GUILE_TLS_CERTIFICATE_DIRECTORY" "/run/current-system/profile/etc/ssl/certs")) (let ((port (parse-port args))) (let ((webserver (resolve-module '(web webserver-aging) #t))) ((module-ref webserver 'start-web-server) "0.0.0.0" (string->number port))))) (main (command-line))