mirror of https://github.com/dapr/docs.git
parent
a2900fe23c
commit
092bfc002e
|
@ -4,6 +4,8 @@ This document shows how to enable Local secret store using [Dapr Secrets Compone
|
||||||
|
|
||||||
> The Local secret store is in no way recommended for production environments.
|
> The Local secret store is in no way recommended for production environments.
|
||||||
|
|
||||||
|
> The Local secret store works with key value pairs.
|
||||||
|
|
||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
- [Create JSON file to hold the secrets](#create-json-file-to-hold-the-secrets)
|
- [Create JSON file to hold the secrets](#create-json-file-to-hold-the-secrets)
|
||||||
|
@ -24,7 +26,7 @@ This creates new JSON file to hold the secrets.
|
||||||
|
|
||||||
## Use Local secret store in Standalone mode
|
## Use Local secret store in Standalone mode
|
||||||
|
|
||||||
This section walks you through how to enable an Local secret store to store a password to access a Redis state store in Standalone mode.
|
This section walks you through how to enable a Local secret store to store a password to access a Redis state store in Standalone mode.
|
||||||
|
|
||||||
1. Create a file called localsecretstore.yaml in the components directory
|
1. Create a file called localsecretstore.yaml in the components directory
|
||||||
|
|
||||||
|
@ -45,6 +47,28 @@ spec:
|
||||||
value: ":"
|
value: ":"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The `nestedSeparator` parameter, is not required (default value is ':') and it's used by the store when flattening the json hierarchy to a map. So given the following json:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"redis": "your redis password",
|
||||||
|
"connectionStrings": {
|
||||||
|
"sql": "your sql connection string",
|
||||||
|
"mysql": "your mysql connection string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
the store will load the file and create a map with the following key value pairs:
|
||||||
|
|
||||||
|
| flattened key | value |
|
||||||
|
| --- | --- |
|
||||||
|
|"redis" | "your redis password" |
|
||||||
|
|"connectionStrings:sql" | "your sql connection string" |
|
||||||
|
|"connectionStrings:mysql"| "your mysql connection string" |
|
||||||
|
|
||||||
|
> Use the flattened key to access the secret.
|
||||||
|
|
||||||
2. Create redis.yaml in the components directory with the content below
|
2. Create redis.yaml in the components directory with the content below
|
||||||
|
|
||||||
Create a statestore component file. This Redis component yaml shows how to use the `redisPassword` secret stored in a Local secret store called localsecretstore as a Redis connection password.
|
Create a statestore component file. This Redis component yaml shows how to use the `redisPassword` secret stored in a Local secret store called localsecretstore as a Redis connection password.
|
||||||
|
@ -63,11 +87,12 @@ spec:
|
||||||
- name: redisPassword
|
- name: redisPassword
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: redisPassword
|
name: redisPassword
|
||||||
key: redisPassword
|
|
||||||
auth:
|
auth:
|
||||||
secretStore: localsecretstore
|
secretStore: localsecretstore
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> Note that the `secretKeyRef` uses the `name` to get the secret.
|
||||||
|
|
||||||
3. Run your app
|
3. Run your app
|
||||||
|
|
||||||
You can check that `secretstores.local.localsecretstore` component is loaded and redis server connects successfully by looking at the log output when using the dapr `run` command.
|
You can check that `secretstores.local.localsecretstore` component is loaded and redis server connects successfully by looking at the log output when using the dapr `run` command.
|
||||||
|
|
Loading…
Reference in New Issue