Skip to content

Commit

Permalink
feat(docs): General improvements to the Secrets concept page.
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanieJKS committed Jul 25, 2022
1 parent d970292 commit 1121edb
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions packages/docs/concepts/secrets.yaml
Expand Up @@ -24,26 +24,22 @@ _ref:
type: Markdown
properties:
content: |
The `secrets` object is a object that can be used to securely store sensitive information like passwords and API keys. Secrets can be accessed using the [`_secret`](/_secret) operator.
The `secrets` object is an object that can be used to securely store sensitive information such as passwords and API keys. Secrets can be accessed using the [`_secret`](/_secret) operator.
The secrets object only exists on the backend server, and therefore the `_secret` operator can only be used in `connections` and `requests`.
We intend to support multiple secrets strategies in the future (for example AWS Secrets Manager or Docker secrets). Current secrets can only be set with environment variables.
## Environment variables strategy
Secrets can be set by creating an environment variable prefixed with `LOWDEFY_SECRET_`. The secret will then be available in the secrets object with the remaining part ot the name as key.
Secrets can be set by creating an environment variable prefixed with `LOWDEFY_SECRET_`. The secret will then be available in the secrets object with the remaining part of the name as key.
For example, if the environment variable `LOWDEFY_SECRET_MY_SECRET` is set to `supersecret`, then `_secret: MY_SECRET` will return `supersecret`.
Only strings can be set as environment variables. To store a object as a secret, the object can be JSON stringified, and parsed using the `_json.parse` operator.
To store secrets that contain newline characters, the secret can be base64 encoded, and decoded using the `_base64.decode` operator.
Only strings can be set as environment variables. To store an object as a secret, the object can be JSON stringified, and parsed using the `_json.parse` operator.
To use secrets in the local development environment, environment variables can be set using a `.env` file. Create a file called `.env` at the root of the project directory. Then set environment variables as:
To use secrets in the local development environment, environment variables can be set using a `.env` file. Create a file called `.env` at the root of the project directory, then set environment variables as follows:
###### .env
```
# .env
LOWDEFY_SECRET_MY_SECRET=supersecret
```
Expand Down

0 comments on commit 1121edb

Please sign in to comment.