integrant icon indicating copy to clipboard operation
integrant copied to clipboard

Uninitialized/literal configs

Open ieure opened this issue 3 years ago • 1 comments

I think that if Integrant has no ig/init-key method defined for a key, it should return the configuration literally. For situations where I have static configuration data, such as:

{:my.thing/output-to "/path/to/place"
 :other.thing/config {:dir #ig/ref :output-to}}

i have to define an ig/init-key method for :output-to which returns the config unmodified. Integrant should do that for me.

ieure avatar Oct 02 '22 18:10 ieure

I considered it, but the disadvantage of defaulting to an identity function is that key typos don't raise an exception.

However, you can always define your own default if you want:

(defmethod ig/init-key :default [k v] v)

weavejester avatar Oct 02 '22 19:10 weavejester