Fork me on GitHub
#duct
<
2021-10-27
>
richiardiandrea15:10:49

Hi folks, I have a module at the top level of my config.edn and using profiles. For some reason the init-key does not get called (I have put printlns in there). Am I missing something w.r.t. to when modules are called?

Kevin16:10:19

Not sure if it matters, but does it derive from :duct/module ?

richiardiandrea17:10:10

Yeah this is what I have in resources/duct_hierarchy.edn

{:duct.profile/web [:duct.profile/base]
 :duct.profile/core [:duct.profile/base]
 :duct.profile/infra [:duct.profile/base]
 :duct.profile/routes [:duct.profile/base]
 :duct.module/reloadable-routes [:duct/module]}

richiardiandrea17:10:23

Is there a way to debug if the module indeed derives that key sorry a bit rusty on these things

richiardiandrea17:10:19

Oh found, sorry for the laziness, will test this at the repl -> https://clojuredocs.org/clojure.core/derive

iarenaza10:10:20

Is that module implemented in a separate library, or is it part of the same code base? Duct needs to load and eval the namespace where the module Integrant multi-method for that key. And by default uses the key name to derive the namespace. If they don't match, then you need to tell Duct/Integrant how to find it, or load and eval the namespace yourself.

richiardiandrea15:10:05

it is in the code base but I think I require the namespaces, I will double check but this is is a very good point