-
Notifications
You must be signed in to change notification settings - Fork 61
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
ClojureScript support for read-string
#73
Comments
It would add an extra dependency to Integrant, but also would only be one more. Could you explain a little more about your use-case? Your configuration is being served from a HTTP server? |
I have an HTTP server that serves Another (future) use-case is that I want to build an electron application, and add Also, not entirely relevant to this issue but you might be wondering: Basically the CLJS client decides what to do with this structure, if new keys get added, it shouldn't affect the system. So any undefined keys inherit from a (defmethod ig/init-key :my-lib/const [_ opts]
opts)
(defn undefined-keys->const
[config]
(doseq [k (keys config) :let [k (parse-key k)]]
(when-not (contains? (methods ig/init-key) k)
(derive k :my-lib/const))))
....
(undefined-keys->const (ig/read-string config)) Adding an options map to |
@weavejester Is this enough information for you? If you're ok with this change then I can start writing the pull request. |
Yes, that's fine. I think it's worth making the tools.reader dependency a provided one, since ClojureScript includes it as a default dependency, so it should be the case that if we're working with ClojureScript, then we already have it in our dependency graph. |
Problem
Currently I have a setup with an HTTP server that returns EDN. I need to be able to read this from my ClojureScript application. However
ig/read-string
is currently only available for Clojure. Possibly for the lack of a built-in EDN library?Solution
We could add tools.reader as a dependency to integrant. That way we can import
cljs.tools.reader.edn
specifically for ClojureScript. This would really help me since I'm now copy pasting integrant'sread-string
function in my ClojureScript application.What do you think of this idea? Do you possibly have a reason to not support ClojureScript?
If you agree to this change then I'd be willing to create a pull request, to save you the hassle.
The text was updated successfully, but these errors were encountered: