Skip to content

Commit 1d39fe8

Browse files
committed
Update variable configuration
Signed-off-by: tpmccallum <[email protected]>
1 parent 62e66be commit 1d39fe8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

examples/vault-variable-test/spin.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@ description = "A simple application that returns query values from variable prov
1010
route = "/..."
1111
component = "vault-variable-test"
1212

13+
[variables]
14+
secret = { required = true }
15+
1316
[component.vault-variable-test]
1417
source = "target/wasm32-wasi/release/vault_variable_test.wasm"
1518
allowed_outbound_hosts = []
1619

20+
[component.vault-variable-test.variables]
21+
password = "{{ secret }}"
22+
1723
[component.vault-variable-test.build]
1824
command = "cargo build --target wasm32-wasi --release"
1925
watch = ["src/**/*.rs", "Cargo.toml"]

examples/vault-variable-test/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use spin_sdk::{
88
#[http_component]
99
fn handle_vault_variable_test(req: Request) -> Result<impl IntoResponse> {
1010
let password = std::str::from_utf8(req.body().as_ref()).unwrap();
11-
let expected = variables::get("test_password").expect("could not get variable");
11+
let expected = variables::get("password").expect("could not get variable");
1212
let response = if expected == password {
1313
"accepted"
1414
} else {

0 commit comments

Comments
 (0)