Skip to content

Instantly share code, notes, and snippets.

@daveyarwood
Last active November 21, 2019 03:03
Show Gist options
  • Save daveyarwood/d31d3fe25297377923b64bd814c4dc0e to your computer and use it in GitHub Desktop.
Save daveyarwood/d31d3fe25297377923b64bd814c4dc0e to your computer and use it in GitHub Desktop.
Dave's setup for starting a prepl server in Boot projects
;; ~/.config/conjure/conjure.edn
{:conns
;; My `prepl-server` task spits out a `.socket-port` file when it starts a
;; prepl server. This configuration allows Conjure to find the prepl server
;; without needing to specify the port explicitly.
{:cwd {:port #slurp-edn ".socket-port"}}}
;; Put this in your boot config file (mine lives at ~/.config/boot/profile.boot)
(deftask prepl-server
"Start a prepl server."
[p port PORT int "The port on which to start the prepl server (optional)."]
(comp
(socket-server
:accept 'clojure.core.server/io-prepl
:port port)
(wait)))
;; Worth noting: I contributed this task to Boot, and it got merged into the
;; master branch, so in some future release of Boot, `prepl-server` will be
;; available out of the box as a built-in task.
# Run this in the root directory of any project with a build.boot
$ boot prepl-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment