main.rkt 980 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #lang racket
  2. (require "ircd.rkt")
  3. (define port-no (make-parameter 6667))
  4. (define bind-host (make-parameter #f))
  5. (define cmdline-parsed
  6. (command-line
  7. #:program "move-night-chat"
  8. #:once-each
  9. [("-u" "--url")
  10. url
  11. "URL for the MoveNight chat server base (default wss://stream.ihatebeinga.live/). Individual endpoints will be e.g. wss://base/channels/CHAN/ws."
  12. (movie-night-ws-url-base url)]
  13. [("-p" "--port")
  14. p
  15. "Specify the port for the IRCd (default 6667)"
  16. (let ([p (string->number p)])
  17. (if p
  18. (port-no p)
  19. (error "Cannot parse the port number")))]
  20. [("--host")
  21. h
  22. "Hostname to bind to (default #f == accept connections to all the addresses)"
  23. (bind-host h)]
  24. #:args ()
  25. (void)))
  26. (define-values (main-thread kill-me)
  27. (serve #:port (port-no) #:hostname (bind-host)))
  28. (printf
  29. "Started the ircd on port ~a :3 :3 :3
  30. Run with --help to see all the options, nyaa.\n" (port-no))
  31. (thread-wait main-thread)