mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-02-23 14:39:32 +08:00
57 lines
2.6 KiB
YAML
57 lines
2.6 KiB
YAML
# Copyright 2020-2021 Lowdefy, Inc
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
_ref:
|
|
path: templates/general.yaml.njk
|
|
vars:
|
|
pageId: secrets
|
|
pageTitle: Secrets
|
|
section: Concepts
|
|
filePath: concepts/secrets.yaml
|
|
content:
|
|
- id: md1
|
|
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 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.
|
|
|
|
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.
|
|
|
|
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:
|
|
|
|
```
|
|
# .env
|
|
LOWDEFY_SECRET_MY_SECRET=supersecret
|
|
```
|
|
|
|
- _ref:
|
|
path: templates/navigation_buttons.yaml
|
|
vars:
|
|
previous_page_title: Operators
|
|
previous_page_id: operators
|
|
next_page_title: Lists
|
|
next_page_id: lists
|