Comments (6)
So, if I'll replace
:data/store
with:sql/store
all refs to:data/store
will be properly resolved?
Yes, that's right. A reference like #ig/ref :data/store
will look for a key that derives from :data/store
.
It's common practice to have both test and production services derive from the same base key, so that you can transparently swap in fake services for testing without altering any other part of the configuration.
I think you want to use the same configuration map in tests as in prod.
Whether you change the keys in the configuration, or change the hierarchy, the resulting system map is the same, and different to production.
My preference is to change the configuration directly, as not only is that simpler (as we don't have to worry about local hierarchies), but it also allows test services to be configured separately to production services.
For example, you might have a fake emailer service that writes to a file, and the filename could be part of the config:
{:fake/emailer {:filename "emails.log"}}
And in production:
{:real/emailer {:smtp "example.com"}}
from integrant.
It's an interesting idea, but why not just change the configuration to use the test key? The effect will be the same without the need to mess around with the hierarchy.
from integrant.
It should be changed more than in one place, right?
Also as I mentioned - i dont want the system-map to be changed.
from integrant.
It should be changed more than in one place, right?
What do you mean? You only need to change the keys you want to replace. Everything else, including references, can remain the same.
Also as I mentioned - i dont want the system-map to be changed.
Do you mean the configuration map? The system map is the return value of ig/init
.
Also why don't you want it to be changed?
from integrant.
What do you mean? You only need to change the keys you want to replace. Everything else, including references, can remain the same.
So, if I'll replace :data/store
with :sql/store
all refs to :data/store
will be properly resolved?
(def system-map
{:adapter/jetty {:port 8080, :handler (ig/ref :handler/greet)}
:sql/store {:jdbc-url "some-yrl}
:handler/greet {:name "Alice", :data-store (ig/ref :data/store)}})
if so - it may solve my issues.
Do you mean the configuration map? The system map is the return value of ig/init.
Yes, sorry, I meant configuration map.
Also why don't you want it to be changed?
I think you want to use the same configuration map in tests as in prod.
from integrant.
Makes sense.
Thanks for clarification!
Closing issue and PR.
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
- Feature proposal: expand-key HOT 2
- Any way to add constant key in `edn`? HOT 2
- Unable to access Presentations(Enter Integrant) HOT 3
- Perhaps use metadata as an alternative to resolve-key? HOT 2
- Refs/Refsets not preserved after expansion HOT 1
- Convenience tag to add methods for static keys HOT 1
- 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.