Fork me on GitHub
#duct
<
2020-02-18
>
keoko09:02:59

Is it possible to change the default http port?

teodorlu09:02:14

See if you're able to control the arguments passed to :duct.server.http/jetty https://github.com/duct-framework/server.http.jetty

teodorlu09:02:06

You might be able to control the arguments passed to it from your system data map.

keoko09:02:10

I’ve tried :duct.server.http/jetty {:port 8888} but I get an error message Execution error (AssertionError) at integrant.core/prep (core.cljc:399). Assert failed: (map? config)

teodorlu09:02:32

Are you sure your system map is well formed? Are you able to able to work with it as a data structure within your normal Clojure code?

teodorlu09:02:08

I suspect you might see something like that if you're missing some parens or have gotten an odd number of entries in your map.

keoko09:02:19

I’ve just tried to parse directly the config.edn file with clojure.edn/read-string and it can read it properly.

keoko09:02:33

I am not sure if it is related that I am not passing the :handler

teodorlu10:02:33

I guess you'd need a handler for any of this to make sense. I still find the Assert failed: (map? config) a bit surprising.

keoko10:02:42

By default the config for :duct.server.http/jetty has this structure {:port 3000, :handler {:duct.handler/root}, :logger {:key :duct/logger}}

keoko10:02:20

thanks @U3X7174KS I’ll try to play a bit more passing a :handler and a :logger

teodorlu10:02:03

I'm by no means a Duct expert myself, but I remember that I had to fiddle a lot with the meaning of all the data stuff before I started to understand how it all fit together. A few more things clicked for me when I worked through this tutorial: https://circleci.com/blog/build-a-clojure-web-app-using-duct/

keoko10:02:59

I also read this blog post. Really good.

Kevin15:02:37

I think you might be defining :duct.server.http/jetty {:port 8888} outside of :duct.profile/base. It should be inside.

Kevin15:02:55

That error happens when you add a regular integrant handler to the "module" space (module space being outside of the base config map)

keoko08:02:21

@kwrooijen it worked, thanks a lot!

Kevin08:02:38

Good to hear, I made a PR to return a better error message when this happens https://github.com/duct-framework/core/pull/32

👏 4
Kevin08:02:07

Hopefully we can get this merged to help new users

keoko09:02:49

that’s great!

teodorlu10:02:03

@UG9U7TPDZ Thanks for creating the PR! I remember having banged my head against the same problem.