Skip to content

Commit 6a7e6e2

Browse files
committed
Add links and refrences to secrets
1 parent fe9a269 commit 6a7e6e2

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

docs/app/docs/configuration.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,34 @@ For example, you could set variable `$FOO` to `bar` by adding the following to y
180180
Currently, you can only set values using string literals, `$PWD`, and `$PATH`. Any other values with environment variables will not be expanded when starting your shell.
181181

182182

183+
### Env From
184+
185+
Env from takes a string or list of strings for loading environment variables into your shells and scripts. Currently it supports loading from two sources: .env files, and Jetify Secrsts.
186+
187+
#### .env Files
188+
189+
You can load environment variables from a `.env` file by adding the path to the file in the `env_from` field. This is useful for loading secrets or other sensitive information that you don't want to store in your `devbox.json`.
190+
191+
```json
192+
{
193+
"env_from": "path/to/.env"
194+
}
195+
```
196+
197+
This will load the environment variables from the `.env` file into your shell when you run `devbox shell` or `devbox run`. Note that environment variables set in the `.env` file will be overridden if the same variable is set directly in your `devbox.json`
198+
199+
#### Jetify Secrets
200+
201+
You can securely load secrets from Jetify Secrets by running `devbox secrets init` and creating a project in Jetify Cloud. This will add the `jetpack-cloud` field to `env_from` in your project.
202+
203+
```json
204+
{
205+
"env_from": "jetpack-cloud"
206+
}
207+
```
208+
209+
Note that setting secrets securetly with Jetify Secrets requires a Jetify Cloud account. For more information, see the [Jetify Secrets](/cloud/docs/secrets/) guide.
210+
183211
### Shell
184212

185213
The Shell object defines init hooks and scripts that can be run with your shell. Right now two fields are supported: `init_hook`, which run a set of commands every time you start a devbox shell, and `scripts`, which are commands that can be run using `devbox run`

docs/app/docs/guides/secrets.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: Managing Secrets and Environment Variables
3+
---
4+
5+
Devbox provides a few different methods for including environment variables and secrets in your Devbox shell. This guide will walk you through the different methods and help you choose the best one for your use case.
6+
7+
## Setting Environment Variables in your Devbox Config
8+
9+
Environment variables that do not need to be stored securely can be set directly in your `devbox.json` under the `env` object. This is useful for non-secret variables that you want to have set in your Devbox shells:
10+
11+
```json
12+
{
13+
"env": {
14+
"MY_VAR": "my_value"
15+
},
16+
"packages": {},
17+
"shell": {}
18+
}
19+
```
20+
21+
Currently, you can only set values using string literals, `$PWD`, and `$PATH`. Any other values with environment variables will not be expanded when starting your shell. For more details, see (/devbox/docs/configuration.md).
22+
23+
## Setting Environment Variables with Env Files
24+
25+
For environment variables that you want to keep out of your `devbox.json` file, you can use an env file. Env files are text files that contain key-value pairs, one per line. You can reference an env file in your `devbox.json` like this:
26+
27+
```json
28+
{
29+
"packages": {},
30+
"shell": {},
31+
"env_from": [
32+
"path/to/.env"
33+
]
34+
}
35+
```
36+
37+
## Securely Managing Secrets with Jetify Secrets
38+
39+
For secrets that need to be stored securely, you can use Jetify Secrets. Jetify Secrets is a secure secrets management service that allows you to store and manage your secrets with Jetify. You can then access your secrets whenever you start your Devbox shell, and manage them from the CLI using [`devbox secrets`](/devbox/docs/cli_reference/devbox_secrets).
40+
41+
To get started with Jetify Secrets, you will need to first create an account on Jetify Cloud and login with `devbox auth login`. Once your account is created, you can create a new project and start adding secrets to your project using `devbox secrets init`.
42+
43+
For more details on how to manage your secrets from the CLI, see our guide on [**Jetify Secrets**](/cloud/docs/secrets/secrets_cli).

0 commit comments

Comments
 (0)