This example relates to the Vault Application Variable Provider Example documentation.
You are best to visit the above link for more information, but for convenience, below is the steps taken to set up the Vault side of the application:
-
Start Vault:
vault server -dev -dev-root-token-id root
- Set a token in Vault:
export VAULT_TOKEN=root
export VAULT_ADDR=http://127.0.0.1:8200
export TOKEN=eyMyJWTToken...
vault kv put secret/secret value=$TOKEN
vault kv get secret/secret
- Build the application:
spin build
- Run the application:
spin up --runtime-config-file runtime_config.toml
- Test the application:
$ curl localhost:3000 --data $TOKEN
{"authentication": "accepted"}