duct

kelveden 2020-02-13T14:41:23.032700Z

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

kelveden 2020-02-13T14:42:34.032900Z

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

kelveden 2020-02-13T14:42:58.033100Z

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

2020-02-13T14:43:19.033400Z

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.

đź‘Ť 1
kelveden 2020-02-13T14:43:54.033600Z

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

byrongibby 2020-02-13T19:36:08.035900Z

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?

kwrooijen 2020-02-13T19:38:00.037300Z

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

kwrooijen 2020-02-13T19:38:11.037500Z

Ataraxy is just the default

2020-02-13T19:40:03.038700Z

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.

byrongibby 2020-02-13T19:43:27.040500Z

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.

byrongibby 2020-02-13T19:47:25.040700Z

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

kwrooijen 2020-02-13T19:47:54.040900Z

I know that it's on github at least https://github.com/yannvanhalewyn/duct-reitit

byrongibby 2020-02-13T19:48:10.041200Z

Thanks!