duct 2021-09-20

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

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

Not #integrant.core.Ref...

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

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

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

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

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

ig/ref? function will return false

but there is a valid integrant key

Thank you for responding at all )

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

it’s how the Ref record printed

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

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

This does return true for me

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

Do you have a stacktrace of the failure?

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}

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

Is the code available anywhere?

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