In my main config I have a :my.email/client key, which is #ig/refed 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/refs 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
Is there maybe another/better way to achieve the same result?
Thanks for your response 👍. I'll try and repro in a test project and post here.