Skip to content

Commit a681329

Browse files
committed
docs: Clarify secret handling in configuration
The previous documentation for secret variables could be misleading. It implied that adding a tag to a value in the file and saving it would cause the value to be encrypted. This is not correct. Encryption is handled by the command, not by a file-watching or editor-integration feature. This commit updates the documentation to clarify that is a YAML tag used to mark already-encrypted values and that the correct way to add and encrypt a new secret is to use the command.
1 parent 1f9d9d7 commit a681329

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

docs/user-guide/01-configuration-file.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,29 @@ environment_variables:
109109

110110
#### A Secret Variable
111111

112-
Use the `!secret` tag to mark a value as a secret. It will be encrypted before being saved.
112+
To handle secrets, `envars` uses the `!secret` YAML tag. This tag indicates that the value is encrypted.
113+
114+
**Important:** You should not manually write plaintext secrets into your `envars.yml` file. The correct way to add a secret is with the `envars add` command and the `--secret` flag.
115+
116+
```bash
117+
$ envars add API_KEY=super-secret-value --secret --env prod
118+
```
119+
120+
When you run this command, `envars` will:
121+
1. Encrypt "super-secret-value" using the configured KMS key.
122+
2. Save the *encrypted ciphertext*, tagged with `!secret`, into your `envars.yml` file.
123+
124+
The resulting `envars.yml` will look something like this:
113125

114126
```yaml
115127
environment_variables:
116128
API_KEY:
117129
description: "API key for the external service."
118-
prod: !secret "super-secret-value"
130+
prod: !secret "CiD...encrypted blob...=="
119131
```
120132

133+
The `!secret` tag tells `envars` that this value needs to be decrypted when you use commands like `envars output` or `envars exec`.
134+
121135
#### A Variable with Location and Environment Overrides
122136

123137
```yaml

0 commit comments

Comments
 (0)