duct

ts1503 2021-09-20T11:56:23.013500Z

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

2021-09-27T19:00:39.021900Z

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

2021-09-27T19:00:48.022100Z

Not #integrant.core.Ref...

2021-09-27T19:01:01.022300Z

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

2021-09-27T19:01:17.022500Z

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

2021-09-27T19:08:07.022700Z

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

ts1503 2021-09-23T08:58:27.020700Z

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

ts1503 2021-09-23T09:00:13.020900Z

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

ts1503 2021-09-23T09:00:33.021300Z

ig/ref? function will return false

ts1503 2021-09-23T09:00:51.021500Z

but there is a valid integrant key

ts1503 2021-09-28T08:27:22.022900Z

Thank you for responding at all )

ts1503 2021-09-28T11:32:44.023100Z

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

ts1503 2021-09-28T11:33:02.023300Z

it’s how the Ref record printed

2021-09-28T11:48:59.023600Z

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

2021-09-28T11:52:48.023800Z

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

2021-09-28T11:52:52.024Z

This does return true for me

2021-09-28T11:54:39.024300Z

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

2021-09-20T12:38:08.013900Z

Do you have a stacktrace of the failure?

ts1503 2021-09-20T17:50:14.018100Z

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}

ts1503 2021-09-20T17:51:12.019400Z

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

2021-09-20T17:55:59.019600Z

Is the code available anywhere?

ts1503 2021-09-20T18:07:38.020400Z

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