Fork me on GitHub
#duct
<
2021-09-20
>
ts150311:09:23

Hello guys. I’ve noticed some weird behavior when I’m trying to start the duct system I have such code

(let [full-config (duct/prep-config config)
        system      (ig/init full-config)
and it failed to start the system because some of the references stay untouched by saying references I mean this #integrant.core.Ref{:key :some/key} The expected behavior is to have the output from the ig/init-key multimethod call instead of the #integrant.core.Ref{:key :some/key} I thought it’s probably due to some issues inside my config but the interesting thing is if I’ll evaluate (duct/prep-config config) in the REPL and copy the output to the (ig/init ...) call the system will start and will work properly Will be really appreciative any help

Kevin12:09:08

Do you have a stacktrace of the failure?

ts150317:09:14

Yes, but error has nothing with duct. It complains that instead of handler function for pedestal service I have a map integrant.core.Ref{:key :some-key}

ts150317:09:12

So the integrant key wasn’t replaced with the value from multimethod

Kevin17:09:59

Is the code available anywhere?

ts150318:09:38

No, it’s in a private repo from my job

ts150308:09:27

Hello again I think I found something interesting my configuration looks like this

{:duct.core/project-ns         test,
  :duct.core/environment        :development,
  :flakes.web/http              {:port   8080,
                                 :routes #integrant.core.Ref{:key :flakes.web/routes},
                                 :env    #integrant.core.Ref{:key :duct.core/environment}},
  :flakes.web.http-test/handler {:context #integrant.core.Ref{:key :flakes.web/context}},
  :flakes.web/context           {:some "configuration"},
  :flakes.web/routes            {:root   test,
                                 :routes [["/test-route" {:get #integrant.core.Ref{:key :flakes.web.http-test/handler}}]]}}

ts150309:09:13

and if I’ll get the handler key from the map

ts150309:09:33

ig/ref? function will return false

ts150309:09:51

but there is a valid integrant key

Kevin19:09:39

I think it's supposed to be #ig/ref

Kevin19:09:48

Not #integrant.core.Ref...

Kevin19:09:01

I don't know if that's valid syntax though

Kevin19:09:17

Actually that looks like a qualified map so it's probably wrong

Kevin19:09:07

(Sorry for replying so late, I didn't get any notification)

ts150308:09:22

Thank you for responding at all )

ts150311:09:44

actually the format #integrant.core.Ref{:key :some/key} is correct

ts150311:09:02

it’s how the Ref record printed

Kevin11:09:59

So you are using the #ig/ref syntax in your EDN file?

Kevin11:09:48

(-> (duct/resource "my_app/config.edn")
    (duct/read-config)
    :duct.profile/base
    :my-app/config
    :database
    ig/ref?)
;; => true

Kevin11:09:52

This does return true for me

Kevin11:09:39

It's hard for me to debug your problem without being able to see where config comes from, and what your config.edn contains