Comments (6)
Labels are already a sort of variable in the context of a spin manifest. Could you share more about what you're trying to do here?
from spin.
What do you mean by labels
?
What I'm trying to do here:
- Have multiple components that should use the same key-value store
- Prevent myself from having the actual name (magic string) of the key-value store in multiple places
Comparing both variants, no. 1 looks cleaner IMO:
Variant 1
#...
[variables]
store = { default = "data" }
[component.a]
source = "a/target/wasm32-wasi/release/a.wasm"
key_value_stores = ["{{ store }}"]
[component.a.variables]
store = "{{ store }}"
[component.b]
source = "b/target/wasm32-wasi/release/b.wasm"
key_value_stores = ["{{ store }}"]
[component.b.variables]
store = "{{ store }}"
# ...
Variant 2
#...
[component.a]
source = "a/target/wasm32-wasi/release/a.wasm"
key_value_stores = ["data"]
[component.a.variables]
store = "data"
[component.b]
source = "b/target/wasm32-wasi/release/b.wasm"
key_value_stores = ["data"]
[component.b.variables]
store = "data"
# ...
from spin.
Variant 3
#...
[component.a]
source = "a/target/wasm32-wasi/release/a.wasm"
key_value_stores = ["data"]
[component.b]
source = "b/target/wasm32-wasi/release/b.wasm"
key_value_stores = ["data"]
# ...
It looks like we aren't using the term "label" consistently in documentation, but it is the term for data
in this example at least internally and in spin-cloud
.
This label is already a "variable" in the sense that it is a arbitrary user-defined identifier that is shared between the manifest and code.
Actually, I think we want to actively avoid the pattern of making these labels dynamic; the long term goal is to use these labels as component model import names, which need to be static.
from spin.
Prevent myself from having the actual name (magic string) of the key-value store in multiple places
You still have a magic string: "store"
; it is just adding an extra layer of indirection.
from spin.
Prevent myself from having the actual name (magic string) of the key-value store in multiple places
You still have a magic string:
"store"
; it is just adding an extra layer of indirection.
Yes but I need it only once 😄 which is actually the point I mentioned
from spin.
I'm also not so sure I understand what this feature would improve.
In the example above with a store labeled as "data" and a variable named "store" that points to that label, the amount of typing/repetition is the same whether you use the variable or not. I suppose if the store label were to change, you would only need to update it in one place, but this doesn't seem like something that will happen often, so I'm not sure the complexity of supporting a templating system is worth it.
from spin.
Related Issues (20)
- Added flexibility to Spin allowed outbound hosts
- inconsistencies when making outbound http requests HOT 1
- Custom trigger with other WASI worlds requires trait implementation for `spin_core::Data<T>` HOT 2
- SQLITE error after update from 2.5.1 to 2.6.0 HOT 3
- spin can not login docker private registry while docker login success HOT 5
- Follow OCI container image annotation standards when generating containers HOT 2
- Generate and sign SBOM through spin HOT 5
- Maintain a CHANGELOG.md file? HOT 2
- Spin (Re)Factors tracking issue
- Add native support for Golang, Python, and JavaScript Azure SDKs HOT 3
- Add native support for Golang and Python AWS SDKs
- Registry metadata support in application manifest HOT 3
- add MAINTAINERS.md file to each repository in Spin project HOT 1
- `spin update` An easier way to update to latest spin version HOT 1
- Endless re-compile in `spin watch` for Spin Apps that consist of multiple components HOT 1
- Hide old plugin versions in `spin plugins list`
- Spin-telemetry: consider eliminating the use of `set_global_default` HOT 1
- inconsistent preopened dirs between wasmtime and spin HOT 8
- Abstract pg client type in factor-outbound-pg
- Need CORS config for HTTP trigger 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 spin.