Skip to content

Commit

Permalink
Merge pull request #1166 from kate-goldenring/update-kv-explorer-docs
Browse files Browse the repository at this point in the history
Update KV explorer docs for latest release
  • Loading branch information
kate-goldenring authored Jan 30, 2024
2 parents 2c4c6b3 + 3e924fc commit 8992108
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
20 changes: 16 additions & 4 deletions content/api/hub/template_kv_explorer.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,24 @@ created_at = "2023-10-15T00:22:56Z"
last_updated = "2023-05-18T00:22:56Z"
spin_version = ">=v1.0"
summary = "A Spin component for exploring the contents of key/value stores."
url = "https://github.com/radu-matei/spin-kv-explorer"
url = "https://github.com/fermyon/spin-kv-explorer"
keywords = "key-value, kv, explorer"

---

The explorer will use the default store to persist the credentials to access the UI and the API. If no values are set, the first invocation will set a randomly generated pair of username and password under the kv-credentials key, with the value following the user:password format. On the first run, the values will be printed in the logs, and they can be used to log in and change them (creating a new credentials value will override the existing value).
This template enables managing the key value pairs set in any key value store linked to an application.

*Known limitations*
the explorer can only be used with Spin's default key/value store. When this will be configurable, this component will support working with custom stores as well.
To keep the contents of your key value store secure, the explorer expects the credentials to access the UI and the API to be stored in the configuration store as variables. Values can be set locally using the [variables provider](https://developer.fermyon.com/spin/v2/dynamic-configuration#application-variables-runtime-configuration) or you can skip checking for the credentials on every request by passing the `SPIN_APP_KV_SKIP_AUTH` environment variable. When deploying to cloud, set the `kv_explorer_user` and `kv_explorer_password` variables using the `--variable` flag. These credentials can then be updated at any time using `spin cloud variables set`.

Visit the [GitHub repo](https://github.com/fermyon/spin-kv-explorer) for complete configuration instructions.

## Installation and Use

```sh
spin templates install --upgrade --git https://github.com/fermyon/spin-kv-explorer
```

Use the `spin add` command to add the KV explorer to your application, specifying `kv-explorer` as the component name.
```sh
spin add kv-explorer -t kv-explorer
```
7 changes: 3 additions & 4 deletions content/spin/v1/ai-sentiment-analysis-api-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -821,16 +821,15 @@ For this, we install use a pre-made template by pointing to the templates GitHub
<!-- @selectiveCpy -->

```bash
$ spin templates install --git https://github.com/radu-matei/spin-kv-explorer
$ spin templates install --git https://github.com/fermyon/spin-kv-explorer
```

Then, we again use `spin add` to add the new component. We will name the component `kv-explorer`):

<!-- @selectiveCpy -->

```bash
$ spin add kv-explorer --accept-defaults
Enter a name for your new application: kv-explorer
$ spin add kv-explorer -t kv-explorer
```

We create an `assets` directory where we can store files to serve statically (see the `spin.toml` file for more configuration information):
Expand Down Expand Up @@ -874,7 +873,7 @@ files = [ { source = "assets", destination = "/" } ]
route = "/..."

[[component]]
source = { url = "https://github.com/radu-matei/spin-kv-explorer/releases/download/v0.9.0/spin-kv-explorer.wasm", digest = "sha256:07f5f0b8514c14ae5830af0f21674fd28befee33cd7ca58bc0a68103829f2f9c" }
source = { url = "https://github.com/fermyon/spin-kv-explorer/releases/download/v0.9.0/spin-kv-explorer.wasm", digest = "sha256:07f5f0b8514c14ae5830af0f21674fd28befee33cd7ca58bc0a68103829f2f9c" }
id = "kv-explorer"
# add or remove stores you want to explore here
key_value_stores = ["default"]
Expand Down
7 changes: 3 additions & 4 deletions content/spin/v2/ai-sentiment-analysis-api-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -977,16 +977,15 @@ For this, we install use a pre-made template by pointing to the templates GitHub
<!-- @selectiveCpy -->

```bash
$ spin templates install --git https://github.com/radu-matei/spin-kv-explorer
$ spin templates install --git https://github.com/fermyon/spin-kv-explorer
```

Then, we again use `spin add` to add the new component. We will name the component `kv-explorer`):

<!-- @selectiveCpy -->

```bash
$ spin add -t kv-explorer --accept-defaults
Enter a name for your new application: kv-explorer
$ spin add kv-explorer -t kv-explorer
```

### Application Manifest
Expand Down Expand Up @@ -1030,7 +1029,7 @@ route = "/internal/kv-explorer/..."
component = "kvv2"

[component.kv-explorer]
source = { url = "https://github.com/radu-matei/spin-kv-explorer/releases/download/v0.6.0/spin-kv-explorer.wasm", digest = "sha256:38110bc277a393cdfb1a885a0fd56923d47314b2086399d1e3bbcb6daa1f04ad" }
source = { url = "https://github.com/fermyon/spin-kv-explorer/releases/download/v0.6.0/spin-kv-explorer.wasm", digest = "sha256:38110bc277a393cdfb1a885a0fd56923d47314b2086399d1e3bbcb6daa1f04ad" }
# add or remove stores you want to explore here
key_value_stores = ["default"]
```
Expand Down

0 comments on commit 8992108

Please sign in to comment.