duct

Ahmed Hassan 2019-06-26T10:57:38.039100Z

What is displace metadata in duct.core.merge/displace?

kwrooijen 2019-06-26T11:11:10.039600Z

From the readme: β€œWe’ve also added merge metadata using merge/displace. This tells merge-configs not to override the port if it already exists in the configuraton.”

πŸ‘ 1
Ahmed Hassan 2019-06-26T12:03:19.039900Z

>In this example we've changed the requirement from :duct.server.http/jetty to the more generic :duct.server/http, which the latter derives from. So, here :duct.server.http/jetty is more specific than :duct.server/http. Right? >The merge-configs function is smart enough to merge :duct.server/http into a more specific derived key, if one exists. What does this mean?

kwrooijen 2019-06-26T13:20:35.040400Z

:duct.server.http/jetty derives from :duct.server/http https://github.com/duct-framework/server.http.jetty/blob/master/src/duct_hierarchy.edn

kwrooijen 2019-06-26T13:21:51.040700Z

In the example, the module is merging :port into your config under :duct.server/http. However if your config contains a key that derives from :duct.server/http (for example, :duct.server.http/jetty), it will merge the port into that

πŸ‘ 1
kwrooijen 2019-06-26T13:25:02.040900Z

(def config1 {:duct.server.http/jetty {}})
(def config2 {:duct.server/http {}})

(duct/merge-configs
 config1
 {:duct.server/http {:port 8080}})
;; => {:duct.server.http/jetty {:port 8080}}

(duct/merge-configs
 config2
 {:duct.server/http {:port 8080}})
;; => {:duct.server/http {:port 8080}}

βœ”οΈ 1
kwrooijen 2019-06-26T13:25:08.041100Z

Something along those lines

kwrooijen 2019-06-26T13:25:34.041300Z

(Note that I just wrote out the idea)

Ahmed Hassan 2019-06-26T14:21:29.041500Z

@kevin.van.rooijen Thanks.

kwrooijen 2019-06-26T14:25:14.041900Z

You’re welcome