integrant

2019-07-14T00:01:20.023200Z

If I understand you correctly, you are talking about using something like WireMock with integrant. I don’t give you a code example, but I can summary how I would use it: - extract the endpoint url as a integrant key - in the test system configuration - make the WireMock a :required key for the component consuming the endpoint url (to keep the correct initialisation order) - replace endpoint url by WireMock url - in your integration tests, you declare the response you want to receive for given request. I hope that will help.

theeternalpulse 2019-07-14T00:21:18.023400Z

I was wondering, if I'm referencing integrant.core :as ig why does aero not look for that when it attempts to read it.

theeternalpulse 2019-07-14T00:21:34.023600Z

if I have #ig/ref in my config

theeternalpulse 2019-07-14T01:59:04.023800Z

I guess I have to do something like

(binding [*data-readers* {'ig/ref ig/ref}]
  (aero/read-config (<http://clojure.java.io/resource|clojure.java.io/resource> "config.edn")))

sandqvist 2019-07-14T07:52:06.024Z

You can just defmethod the reader, take my snippet above and replace component with ig/ref. Aero has its own multimethod for adding readers.

theeternalpulse 2019-07-14T08:58:35.024200Z

Cool I think I got a good solution using aero, consolidates things nicely, just took some time experimenting

j0ni 2019-07-14T09:15:53.024500Z

@grzegorzrynkowski_clo thanks for taking the time! I will try that out. I had not heard of WireMock previously.

1👍
theeternalpulse 2019-07-14T21:31:56.026800Z

is there a way in aero to have a key completely removed from the final map. Let's say I have a key that's solely used from importing, and referenced by other areas of the config, but since integrant only allows keys that have an init, I want it to not be there in the final output. I figured I can just disassoc it from the map before doing integrant, but figured there may be an easier way to just ignore it altogether.

2019-07-14T22:02:18.038300Z

@theeternalpulse If I understand you correctly, you declare in your config map some kind of intermediary/helper component (that you use in some other components as a dependency) and you don’t want to have it in the final system map built by integrant. If that is correct I don’t think there is a solution out of the box. As you noticed you can dissoc it, but I think ignoring it is probably the best option. Integrant is not designed to keep only the major components of your system. It is designed to contain all the elements (even the smallest) that are relevant for initialising your system. In #duct, the extension of the Integrant concept, you can notice that Duct contains special key type for const values, so in the design, Duct encourages to keep even such a single values in the final system map. I mean the idea of removing it, it is quite interesting, although personally, I don’t see a lot of value in it. I like to have all the intermediary elements so I can see what data had been used to initiate all of my components. If I cut them off, it is not easy or it is even impossible to check from REPL what data had been used to initialise the components. I hope that helps 🙂

theeternalpulse 2019-07-14T22:30:46.040300Z

I guess dissoc'ing only at the final use is the best, allows debugging of the entire config at some point easier

theeternalpulse 2019-07-14T22:32:08.040800Z

I only have an "ignored" key because aero has functionality to do something like

:app-config #include #join [#or [#env HOME
                                  #env CONFIG-DIR] "/.parrot.config.edn"]

theeternalpulse 2019-07-14T22:32:31.041400Z

and ref it in the config at load-time

theeternalpulse 2019-07-14T22:32:42.041600Z

the aero ref not integrant

theeternalpulse 2019-07-14T22:33:08.042Z

I guess I can just make a dummy init that returns that same config

theeternalpulse 2019-07-14T22:33:32.042500Z

but dissoc is just be the most straightforward