This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-13
Channels
- # babashka (5)
- # beginners (52)
- # biff (11)
- # brompton (5)
- # calva (2)
- # cider (7)
- # clojure (80)
- # clojure-europe (3)
- # clojure-finland (1)
- # clojure-nl (3)
- # clojure-norway (1)
- # clojure-uk (3)
- # clojurescript (15)
- # conjure (4)
- # core-async (9)
- # cursive (3)
- # datahike (38)
- # datascript (1)
- # datomic (7)
- # duct (9)
- # emacs (4)
- # fulcro (11)
- # graalvm (21)
- # honeysql (5)
- # lambdaisland (1)
- # leiningen (1)
- # news-and-articles (1)
- # off-topic (8)
- # react (42)
- # reagent (6)
- # reitit (11)
- # shadow-cljs (62)
- # specter (1)
- # spire (2)
- # sql (1)
- # tools-deps (12)
- # vim (5)
In my main config I have a :my.email/client
key, which is #ig/ref
ed by a number of other components. What's the Right Way to replace that component in my dev profile with :my.email/dev-client
, so that all refs are updated automatically (so that I don't have to hunt down each reference to my.email/client
and override it)?
Even better is if it can prevent the :my.email/client
key from ever being initialized, since its config is validated in ig/pre-init-spec
I've thought about these options:
* Determining which component (real or dev client) to init in ig/init-key :my.email/client
, based on config. This is quick and easy, but mixes test- and prod code, which is less nice.
* Using :my.email/real-client
and :my.email/dev-client
keys which both derive from :my.email/client
, with :my.email/real-client
configured in the base profile, and :my.email/dev-client
in the dev profile. However, if I do this I'll still have to dissoc :my.email/real-client
from the config before initializing the system, otherwise I'll have both defined, and :my.email/real-client
is still initialized.
I've also tried just overriding :my.email/client
in my dev profile, but then it seems like all the #ig/ref
s to it from other components are broken
Overriding it in dev.edn
profile should work. Is :my.email/client
a base profile key, or a module key?
I figured out a way to do it: by introducing an intermediate component :my.email/client
, which is referenced by other components, and returns the component it is configured with. In the base profile it is configured with my.email/real-client
, and in dev profile with my.email/dev-client
.
This gist has more details: https://gist.github.com/walterl/70607e342ea8bf6cd3f0b5b4c97379c8