@creese has joined the channel
I’m looking for a good example showing how to use integrant and integrant.repl in the same project with separate configs and methods.
I’d like to use the dev config at the REPL and the prod config when run from the command-line use clj -m <namespace-with-my-main-function>
The issue isn’t really that I have different configs. It’s that I have different (defmethod ig/init-key :some-key [...] ... )
@creese Is there a specific reason why you have different init-key for prod and dev?
maybe sth like this, with additional :dev true option passed to components. https://github.com/223kazuki/re-integrant-app/blob/master/dev/src/user.cljs#L10
We use fake Kafka topic definitions with EDN serdes in dev to speed development. In production, use Avro. We also want to specify other things like the number of partitions the topic has which in dev is not as important.
Right now, I’m doing this for the prod intializers:
(if-not (get-method ig/init-key :topics)
;; Install this only if not already installed
...
)
Feels a bit smelly but it works.
For prod, there isn’t a problem because the user namespace isn’t loaded.
But the dev initializers can be overridden depending on which namespace is loaded first.
Both configs contain :some-key but when init-ing at the REPL or from the command-line, I’d like these to do different things.
This can be solved fairly easily at the command-line because the user namespace is not loaded. However, I haven’t found a good way to ignore the prod init-key methods when I’m in at the REPL.
I guess one way would be to only define the prod methods if the user namespace is absent, but that feels bit klugey.
This appears to work:
(if-not (get-method ig/init-key :some-key)
(defmethod ig/init-key :some-key [ ... ]
...
))
@abdusalam has joined the channel
Hello all. Is there a specific reason why integrant.core/load-namespaces is only available for clj?
oh, I guess you can't dynamically resolve symbols in cljs.