Fork me on GitHub
#duct
<
2019-06-26
>
Ahmed Hassan10:06:38

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

Kevin11:06:10

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.”

👍 4
Ahmed Hassan12:06:19

>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?

Kevin13:06:51

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

👍 4
Kevin13:06:02

(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}}

✔️ 4
Kevin13:06:08

Something along those lines

Kevin13:06:34

(Note that I just wrote out the idea)

Kevin14:06:14

You’re welcome