Comments (4)
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.
from integrant.
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?
from integrant.
I have an HTTP server that serves Content-Type: application/edn
. And multiple integrant based services that call this HTTP server. One of them being a ClojureScript application. The CLJS application makes an HTTP call, the EDN arrives as text. I then use (my copied) ig/read-string
function on the payload.
Another (future) use-case is that I want to build an electron application, and add edn
files in the build. Since the electron will build a package with the edn files included, this becomes possible.
Also, not entirely relevant to this issue but you might be wondering:
"If you add a new key to the remote server, and don't add the init-key
to the CLJS application, it will break"
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 const
init-key.
(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 ig/read-string
, for example (ig/read-string {:derive-missing-keys :my-lib/const} config)
could come in handy (in my case, at least). But that's for another issue
from integrant.
@weavejester Is this enough information for you? If you're ok with this change then I can start writing the pull request.
from integrant.
Related Issues (20)
- Uninitialized/literal configs HOT 1
- Tests don't run with 1.11 due to clojure.test/run-test already being defined HOT 1
- Access to Enter Integrant presentation HOT 2
- Clarity on handling prod/dev config HOT 1
- Initialisation Order HOT 5
- Deprecate :include-refsets? in favor of :include-reflikes? HOT 16
- Decouple top-level keys from configuration type definitions HOT 9
- [Feature] Ability to provide custom hierarchy to `init` method HOT 6
- Would you consider an integrant2 to support extensible build steps? HOT 10
- Why does resume halt unspecified system keys? HOT 4
- Support usage in Babashka environments HOT 20
- #{:idea} Pass the spec validations step on all defined states before calling init-key. HOT 1
- is it possible to access a component after it's init-key, but before it gets passed to the next key that depends on it? HOT 2
- Enter Integrant Video
- Add support for custom assertf definitions HOT 2
- Question: Extract "validation keys" logic from core/build implementation HOT 4
- Feature request: pre-init hook
- No method in multimethod 'init-key' for dispatch value HOT 2
- #ig/ref should allow for deep references HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from integrant.