
longer any need to restart the server. * Added a 'hook-file option that specifies a module providing a generic hook. Useful for notifications when important things happen, but can be used for anything. Reloaded on change too. svn: r5463
81 lines
2.9 KiB
Scheme
81 lines
2.9 KiB
Scheme
(module web-status-server mzscheme
|
|
(require (lib "unit.ss")
|
|
(lib "ssl-tcp-unit.ss" "net")
|
|
(lib "tcp-sig.ss" "net")
|
|
(lib "tcp-unit.ss" "net")
|
|
(lib "file.ss")
|
|
(lib "etc.ss")
|
|
(lib "web-server-unit.ss" "web-server")
|
|
(lib "sig.ss" "web-server")
|
|
(lib "configuration.ss" "web-server")
|
|
"private/config.ss")
|
|
|
|
(provide serve-status)
|
|
|
|
(define (serve-status port-no)
|
|
|
|
(define web-dir
|
|
(path->string
|
|
(or (get-conf 'web-base-dir)
|
|
(build-path (this-expression-source-directory) "status-web-root"))))
|
|
|
|
(define config
|
|
`((port ,port-no)
|
|
(max-waiting 40)
|
|
(initial-connection-timeout 30)
|
|
(default-host-table
|
|
(host-table
|
|
(default-indices "index.html")
|
|
(log-format parenthesized-default)
|
|
(messages
|
|
(servlet-message "servlet-error.html")
|
|
(authentication-message "forbidden.html")
|
|
(servlets-refreshed "servlet-refresh.html")
|
|
(passwords-refreshed "passwords-refresh.html")
|
|
(file-not-found-message "not-found.html")
|
|
(protocol-message "protocol-error.html")
|
|
(collect-garbage "collect-garbage.html"))
|
|
(timeouts
|
|
(default-servlet-timeout 120)
|
|
(password-connection-timeout 300)
|
|
(servlet-connection-timeout 86400)
|
|
(file-per-byte-connection-timeout 1/20)
|
|
(file-base-connection-timeout 30))
|
|
(paths
|
|
(configuration-root "conf")
|
|
(host-root ,web-dir)
|
|
(log-file-path ,(cond [(get-conf 'web-log-file) => path->string]
|
|
[else #f]))
|
|
(file-root "htdocs")
|
|
(servlet-root ,web-dir)
|
|
(mime-types ,(path->string
|
|
(build-path (collection-path "web-server")
|
|
"default-web-root"
|
|
"mime.types")))
|
|
(password-authentication "unused"))))
|
|
(virtual-host-table)))
|
|
|
|
(define configuration
|
|
(load-configuration-sexpr
|
|
web-dir config
|
|
#:make-servlet-namespace
|
|
(make-make-servlet-namespace
|
|
#:to-be-copied-module-specs
|
|
'((lib "md5.ss" "handin-server" "private")
|
|
(lib "logger.ss" "handin-server" "private")
|
|
(lib "config.ss" "handin-server" "private")
|
|
(lib "hooker.ss" "handin-server" "private")
|
|
(lib "reloadable.ss" "handin-server" "private")))))
|
|
|
|
(define-unit-binding config@ configuration (import) (export web-config^))
|
|
(define-unit-binding ssl-tcp@
|
|
(make-ssl-tcp@ "server-cert.pem" "private-key.pem" #f #f #f #f #f)
|
|
(import) (export tcp^))
|
|
(define-compound-unit/infer status-server@
|
|
(import)
|
|
(link ssl-tcp@ config@ web-server@)
|
|
(export web-server^))
|
|
(define-values/invoke-unit/infer status-server@)
|
|
|
|
(serve)))
|