From 663be9e77ce6744582695d497e2393ca9311b3ad Mon Sep 17 00:00:00 2001 From: pho4cexa Date: Fri, 2 Dec 2022 14:54:09 -0800 Subject: [PATCH] simplify capture of env vars with defaults --- main.scm | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/main.scm b/main.scm index 314fe25..e03da82 100644 --- a/main.scm +++ b/main.scm @@ -46,22 +46,12 @@ (define *repository-name* #f) (define *repository-directory* #f) -(define WEB-DIRECTORY (let ((environment-variable (get-environment-variable "GIT_WWW"))) - ;; this seems silly, but i'm not sure how else i should do it haha - (if environment-variable environment-variable "/var/www/git"))) +(define WEB-DIRECTORY (or (get-environment-variable "GIT_WWW") "/var/www/git")) +(define CLONE-URL (or (get-environment-variable "GIT_WWW_CLONE_URL") "git://git.example.com")) +(define TITLE (or (get-environment-variable "GIT_WWW_TITLE") "my git repositories")) +(define DESCRIPTION (or (get-environment-variable "GIT_WWW_DESCRIPTION") "my git repositories")) +(define H1 (or (get-environment-variable "GIT_WWW_H1") "git.example.com")) -(define CLONE-URL (let ((environment-variable (get-environment-variable "GIT_WWW_CLONE_URL"))) - ;; this seems silly, but i'm not sure how else i should do it haha - (if environment-variable environment-variable "git://git.example.com"))) - -(define TITLE (let ((environment-variable (get-environment-variable "GIT_WWW_TITLE"))) - (if environment-variable environment-variable "my git repositories"))) - -(define DESCRIPTION (let ((environment-variable (get-environment-variable "GIT_WWW_DESCRIPTION"))) - (if environment-variable environment-variable "my git repositories"))) - -(define H1 (let ((environment-variable (get-environment-variable "GIT_WWW_H1"))) - (if environment-variable environment-variable "git.example.com"))) (define HTML-TEMPLATE #<