(functor ; functor and argument ((awful main) (S (run))) ; exports () ; imports (import (scheme) (define-options) (only (awful) awful-start) (only (chicken format) printf sprintf) (only (chicken pathname) pathname-directory) (only (chicken process-context) executable-pathname) (prefix (spiffy) sp:) (prefix (S) site:)) ; command line arguments parsing (define root (pathname-directory (executable-pathname))) (define-options (main) `((user "User to drop privileges to" (value (required user))) (addr "Address to bind to" (value (required address)) (default "127.0.0.1")) (port "Port to bind to" (value (required port) (predicated ,integer?) (transformer ,string->number)) (default 8080)) (access-log "Access log path" (value (required path)) (default ,(sprintf "~A/access.log" root))) (debug-log "Debug log path" (value (required path))) (error-log "Error log path" (value (required path)) (default ,(sprintf "~A/error.log" root))) (web-root ,(sprintf "Web-root path") (value (required path)) (default ,(sprintf "~A/static" root))) (dev "Run awful in development mode" (value #f)) (args "Pass additional arguments to site:run" (value #f)))) ; setup (sp:root-path web-root) (sp:spiffy-user user) (sp:server-bind-address addr) (sp:server-port port) (sp:access-log access-log) (if debug-log (sp:debug-log debug-log)) (sp:error-log error-log) ; off we go... (awful-start (lambda () (if args (site:run (cdr argument-stragglers)) (site:run))) dev-mode?: dev))