spinframework / spinframework/spin

Enable mustache-inspired string templates for `key_value_stores` and others

Open
#2,577 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
6.5k
Forks
310
Avg merge
1d 20h
Merged PRs (30d)
24

Description

I'm building a Spin App that consists of multiple components:

# ...

[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"]

# ...

Instead of providing the magic string (name of the desired key-value store) 4 times (twice as part of key_value_stores and once per component), I would want to use mustache-inspired string templates as illustrated here:

#...

[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 }}"

# ...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the TOML examples in the issue and trace how variables, key_value_stores, and component variables are currently represented and resolved. Done means a shared variable such as store can be used in those fields with mustache-inspired syntax, while preserving the existing configuration behavior.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.