Fork me on GitHub
#duct
<
2020-06-13
>
walterl01:06:53

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)?

walterl01:06:06

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

walterl01:06:46

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.

walterl01:06:54

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

kwrooijen11:06:36

Overriding it in dev.edn profile should work. Is :my.email/client a base profile key, or a module key?

walterl18:06:19

Thanks for your response 👍. I'll try and repro in a test project and post here.

walterl02:06:34

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.

walterl02:06:39

Is there maybe another/better way to achieve the same result?