Skylar Hill
61e8ea172f
It doesn't work for because the session gets invalidated for, and I quote, "some reason." Thanks, guile-gnutls. The code is also ugly and needs refactoring to be cleaner. We can separate a lot of things into their own functions for readability.
58 lines
1.4 KiB
Text
58 lines
1.4 KiB
Text
#!@GUILE@ \
|
|
--no-auto-compile -e main -s
|
|
!#
|
|
|
|
(use-modules (config)
|
|
(config api)
|
|
(config licenses)
|
|
(config parser sexp)
|
|
(ice-9 sandbox)
|
|
(goblins)
|
|
(starvat listener)
|
|
(starvat handler))
|
|
|
|
(define %configuration
|
|
(configuration
|
|
(name 'starvat)
|
|
(version @HVERSION@)
|
|
(author @AUTHOR@)
|
|
(copyright @COPYRIGHT@)
|
|
(license @LICENSE@)
|
|
(synopsis "A Gemini server based on Spritely's Goblins")
|
|
(description
|
|
"TODO")
|
|
(keywords
|
|
(list
|
|
(setting
|
|
(name 'resources)
|
|
(default `(("localhost" . ,(string-append (getenv "HOME")
|
|
"/gemini"))))
|
|
(test list?)
|
|
(handler eval-in-sandbox))))
|
|
(directory (list (path (given "/etc/starvat/")
|
|
(eager? #f))
|
|
(in-home ".config/starvat")))
|
|
(parser simple-sexp-parser)
|
|
(generate-cmdtree? #t)))
|
|
|
|
(define (main args)
|
|
(define options (getopt-config-auto args %configuration))
|
|
(define listener-vat (spawn-vat))
|
|
(define handler-vat (spawn-vat))
|
|
(define listener
|
|
(with-vat listener-vat
|
|
(spawn ^listener 1965
|
|
(string-append (getenv "HOME") "/localhost.crt")
|
|
(string-append (getenv "HOME") "/localhost.key"))))
|
|
(display options)
|
|
(display (option-ref options 'resources))
|
|
(define handler
|
|
(with-vat handler-vat
|
|
(spawn ^handler options)))
|
|
(with-vat listener-vat
|
|
($ listener 'init)
|
|
($ listener 'listen handler)))
|
|
|
|
;;; Local Variables:
|
|
;;; mode: scheme
|
|
;;; End:
|