You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is a common pattern to include a default configuration with your application and then override those defaults from other sources(if found) during deployment. Aero'r #include tag seems particularly useful in such situations. The problem is, it does not handle missing files gracefully. Also, the course of action taken for a missing file varies greatly depending on the resolver in use.
After some discussion in clojure slack, someone suggested that a custom reader tag would do the job and it would be trivial to implement. As such, here's an implementation of the #opt-include tag,
which takes a filename along with a default value(which is used if the file is missing), passed as a 2-element vector:
I think this is better to be done in user-code and not Aero. As you say, Aero:
it does not handle missing files gracefully
which is sort of the point. Aero sticks to the principle of zero overrides - the absence of a config file shouldn't cause a change to the config. Instead, it should cause the config loading to fail.
I realise current resolvers' behaviours vary, and that isn't ideal. However, I think we should still preserve the philosophy of Aero in this regards.
It is a common pattern to include a default configuration with your application and then override those defaults from other sources(if found) during deployment. Aero'r
#include
tag seems particularly useful in such situations. The problem is, it does not handle missing files gracefully. Also, the course of action taken for a missing file varies greatly depending on the resolver in use.After some discussion in clojure slack, someone suggested that a custom reader tag would do the job and it would be trivial to implement. As such, here's an implementation of the
#opt-include
tag,which takes a filename along with a default value(which is used if the file is missing), passed as a 2-element vector:
Example configuration file using
#opt-include
:I plan to submit a pull request later.
The text was updated successfully, but these errors were encountered: