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}}
I could create a separate file to accommodate the config using #duct/include
but that feels a bit a heavyweight for the job.
Particularly if I'm going to have a different shared config injected per duct profile.
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.
Ah I'd forgotten that there was a :duct/const
thanks!
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?
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
Ataraxy is just the default
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.
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.
Where can I find the duct-reitit package, it doesn't turn up on a search in Clojars?
I know that it's on github at least https://github.com/yannvanhalewyn/duct-reitit
Thanks!