-
Notifications
You must be signed in to change notification settings - Fork 15
Supplying custom data readers to defconfig #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've solved this in Phoenix by making the Certainly happy to have a PR! Cheers |
Hi James, thanks for the response. My opinion (though not strong) I think it is more flexible if you allow them to be optionally passed in. That way you know explicitly what is legal for your config file. If you really want data-readers to be consulted you can still pass it in. |
Yep, good point - so would you have them passed in as an optional extra argument to |
Yes, I was probably thinking an optional keyword argument... (just in case you ever want to add other optional parameters to defconfig) so the defconfig macro could be like the following.
When supplied they would be merged with the existing nomad data readers. |
I've just released 0.7.1-SNAPSHOT, which now takes (defconfig my-config (io/resource "...") {:data-readers {'my-reader/reader-type parse-reader-type}}) Let me know what you think :) Cheers, James |
Thanks James - you beat me to it... I started on the code last night. I'll try it out (hopefully today). |
OK, tried it out - I got the following error:
I think there's a missing ~ in front of data-readers in the defconfig macro. |
Thanks Lloyd, sorry for that :/ James |
No trouble. I should have a chance today to try it out. |
Thanks for that. Looks good to me, worked for my simple test cases. I tried specifying the optional extra parameter, and then without it. I didn't try binding |
Hi James, I'm wondering whether this change is likely to make it into the main release anytime soon. It certainly works for our needs. Are you waiting for feedback on issue #19 before you would consider releasing it ?
|
Sorry - had forgotten about this - I've just a 0.7.1 release. Let me know what you think :) James |
Hey no trouble. Will integrate into our main development line soon. Thanks again. |
No worries, thanks for your suggestion! |
I'd like to optionally be able to supply custom data readers when specifying my config.
So the use of defconfig might look like the following.
I originally thought I might have been able to achieve this by binding
*data-readers*
, but it turns out that the underlying edn reader doesn't allow for that (probably with good reason).I would be happy to do the implementation for you to have a look at.
What do you think?
The text was updated successfully, but these errors were encountered: