Fork me on GitHub
#duct
<
2020-02-13
>
kelveden14:02:23

Is there a canonical way of sharing config across multiple components? Something along these lines:

{:shared-config {:a "valuea" :"valueb"}
 :my-namespace/my-component1 {:config #config-ref :shared-config}
 :my-namespace/my-component2 {:config #config-ref :shared-config}}

kelveden14:02:34

I could create a separate file to accommodate the config using #duct/include but that feels a bit a heavyweight for the job.

kelveden14:02:58

Particularly if I'm going to have a different shared config injected per duct profile.

weavejester14:02:19

You can either use #ig/ref on a key that initiates to itself (you can derive from :duct/const) or #duct/include if you put the configuration in a separate file.

đź‘Ť 4
kelveden14:02:54

Ah I'd forgotten that there was a :duct/const thanks!

byrongibby19:02:08

Hi. Please excuse my ignorance, but I have two quick noob questions: 1. Is Duct to Integrant what danielsz/system is to Component? 2. Would it make sense to use the reitit router in the Duct framework?

Kevin19:02:00

1. not familiar with that so no idea 2. Yes, you can technically use any clojure library, there's also a duct-reitit package available

byrongibby19:02:25

Where can I find the duct-reitit package, it doesn't turn up on a search in Clojars?

Kevin19:02:11

Ataraxy is just the default

weavejester19:02:03

1. Not really… Duct’s main addition is the introduction of modules, which are a form of higher order configuration. You write a configuration in Duct, which is transformed into another configuration, which is then executed by Integrant.

byrongibby19:02:27

Great, thanks for the help. I spent some time learning Component as it is set up using the Chestnut template, but I get the feeling that Component is no longer best practice and I should switch to Integrant. Based on the replies I am going to take the time to learn Duct.