Local file (for Development)

Detailed information on the local file secret store component

This Dapr secret store component reads plain text JSON from a given file and does not use authentication.

Setup JSON file to hold the secrets

  1. Create a JSON file (i.e. secrets.json) with the following contents:

        "redisPassword": "your redis passphrase"
  2. Save this file to your ./components directory or a secure location in your filesystem

Configure Dapr component

Create a Dapr component file (ex. localSecretStore.yaml) with following content:

apiVersion: dapr.io/v1alpha1
kind: Component
  name: local-secret-store
  namespace: default
  type: secretstores.local.file
  - name: secretsFile
    value: [path to the JSON file]
  - name: nestedSeparator
    value: ":"

The nestedSeparator parameter is optional (default value is ‘:'). It is used by the store when flattening the json hierarchy to a map.


Given the following json:

    "redisPassword": "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 (connectionStrings:sql) to access the secret.