File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
examples/vault-variable-test Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,16 @@ description = "A simple application that returns query values from variable prov
10
10
route = " /..."
11
11
component = " vault-variable-test"
12
12
13
+ [variables ]
14
+ secret = { required = true }
15
+
13
16
[component .vault-variable-test ]
14
17
source = " target/wasm32-wasi/release/vault_variable_test.wasm"
15
18
allowed_outbound_hosts = []
16
19
20
+ [component .vault-variable-test .variables ]
21
+ password = " {{ secret }}"
22
+
17
23
[component .vault-variable-test .build ]
18
24
command = " cargo build --target wasm32-wasi --release"
19
25
watch = [" src/**/*.rs" , " Cargo.toml" ]
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use spin_sdk::{
8
8
#[ http_component]
9
9
fn handle_vault_variable_test ( req : Request ) -> Result < impl IntoResponse > {
10
10
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" ) ;
12
12
let response = if expected == password {
13
13
"accepted"
14
14
} else {
You can’t perform that action at this time.
0 commit comments