aboutsummaryrefslogtreecommitdiff
path: root/haunt/jakob/dynamic/config.scm
diff options
context:
space:
mode:
authorJakob L. Kreuze2023-08-05 16:15:15 -0400
committerJakob L. Kreuze2023-08-05 16:34:26 -0400
commite6c965ac0033a32dfa19c13701b6cd087c92385a (patch)
tree88358542e6ff743a07ef958b7e4fc0924e6f10dc /haunt/jakob/dynamic/config.scm
parent323c8449e2d8a7c1f5a51689fc1e5bc298eb5355 (diff)
[dynamic] Re-implement RSVP using SSR
Diffstat (limited to 'haunt/jakob/dynamic/config.scm')
-rw-r--r--haunt/jakob/dynamic/config.scm13
1 files changed, 12 insertions, 1 deletions
diff --git a/haunt/jakob/dynamic/config.scm b/haunt/jakob/dynamic/config.scm
index 5eb615b..8fc9dea 100644
--- a/haunt/jakob/dynamic/config.scm
+++ b/haunt/jakob/dynamic/config.scm
@@ -16,7 +16,9 @@
(define-module (jakob dynamic config)
#:export (%debug-enabled
- paramstring-for-dbname))
+ %api-server-port
+ paramstring-for-dbname
+ absolute-url))
;; Whether or not to enable "debug mode", in which:
;;
@@ -24,6 +26,9 @@
;; - Rate limiting is disabled.
(define %debug-enabled (make-parameter (or (getenv "API_SERVER_DEBUG") #f)))
+;; Port that the API server should listen on
+(define %api-server-port (make-parameter (or (getenv "API_SERVER_PORT") 8080)))
+
;; Should be fairly self-explanatory.
(define %postgresql-user (make-parameter (or (getenv "API_SERVER_DB_USER") "jakob_dynamic")))
(define %postgresql-host (make-parameter (or (getenv "API_SERVER_DB_HOST") "localhost")))
@@ -35,3 +40,9 @@
(%postgresql-port)
(%postgresql-user)
dbname))
+
+(define (absolute-url relative-path)
+ "Produce an absolute URL from the identifier RELATIVE-PATH"
+ (if (%debug-enabled)
+ (format #f "http://localhost:~a/~a" (%api-server-port) relative-path)
+ (string-append "https://jakob.space" relative-path)))

© 2015 - 2026 Jakob L. Kreuze