Complain if no canonical-hosts are available

This commit is contained in:
Tony Garnock-Jones 2016-11-21 11:51:38 +13:00
parent f9f5e41c9d
commit d83a87f0f4
2 changed files with 5 additions and 7 deletions

View File

@ -6,6 +6,7 @@
(require "private/util.rkt")
(require "protocol.rkt")
(require/activate syndicate/drivers/timestate)
(require/activate "config.rkt")
(require/activate "hub/static-content.rkt")
(require/activate "hub/topic-demand.rkt")
@ -32,6 +33,9 @@
(define/query-set canonical-local-hosts ($ c (canonical-local-host _ _)) c)
(stop-when (rising-edge (> (set-count (canonical-local-hosts)) 1))
(log-error "Too many canonical-host records in configuration."))
(on-start (sleep 0.1)
(when (set-empty? (canonical-local-hosts))
(log-error "No canonical-host records specified; try the --canonical-host command line argument")))
;; TODO: Make the too-many-canonical-host-records situation recoverable.
;; TODO: And/or, make the whole application quit when it gets into a bad state.

View File

@ -1,7 +1,6 @@
#lang racket/base
(provide sleep
random-hex-string
(provide random-hex-string
extend-url-string-query
web-respond/status!
web-request!
@ -23,11 +22,6 @@
(module+ test (require rackunit))
(define (sleep sec)
(define timer-id (gensym 'sleep))
(until (message (timer-expired timer-id _))
(on-start (send! (set-timer timer-id (* sec 1000.0) 'relative)))))
(define (random-hex-string half-length)
(bytes->hex-string (crypto-random-bytes half-length)))