diff --git a/docs/app/docs/configuration.md b/docs/app/docs/configuration.md index dcad736775a..ce5f9a64efd 100644 --- a/docs/app/docs/configuration.md +++ b/docs/app/docs/configuration.md @@ -182,11 +182,11 @@ Currently, you can only set values using string literals, `$PWD`, and `$PATH`. A ### Env From -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. +Env from takes a string for loading environment variables into your shells and scripts. Currently it supports loading from two sources: .env files, and Jetify Secrets. #### .env Files -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`. +You can load environment variables from a `.env` file by adding the path to the file in the `env_from` field (the file must end with `.env`). This is useful for loading secrets or other sensitive information that you don't want to store in your `devbox.json`. ```json { @@ -198,15 +198,15 @@ This will load the environment variables from the `.env` file into your shell wh #### Jetify Secrets -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. +You can securely load secrets from Jetify Secrets by running `devbox secrets init` and creating a project in Jetify Cloud. This will add the `jetify-cloud` field to `env_from` in your project. ```json { - "env_from": "jetpack-cloud" + "env_from": "jetify-cloud" } ``` -Note that setting secrets securetly with Jetify Secrets requires a Jetify Cloud account. For more information, see the [Jetify Secrets](/docs/cloud/secrets/) guide. +Note that setting secrets securely with Jetify Secrets requires a Jetify Cloud account. For more information, see the [Jetify Secrets](/docs/cloud/secrets/) guide. ### Shell diff --git a/docs/app/docs/guides/secrets.md b/docs/app/docs/guides/secrets.md index 10035232a0f..fb670bf9144 100644 --- a/docs/app/docs/guides/secrets.md +++ b/docs/app/docs/guides/secrets.md @@ -28,9 +28,7 @@ For environment variables that you want to keep out of your `devbox.json` file, { "packages": {}, "shell": {}, - "env_from": [ - "path/to/.env" - ] + "env_from": "path/to/.env" } ``` diff --git a/internal/devbox/devbox.go b/internal/devbox/devbox.go index d36d74c5036..a8a24a0b30b 100644 --- a/internal/devbox/devbox.go +++ b/internal/devbox/devbox.go @@ -32,6 +32,7 @@ import ( "go.jetpack.io/devbox/internal/devbox/envpath" "go.jetpack.io/devbox/internal/devbox/generate" "go.jetpack.io/devbox/internal/devconfig" + "go.jetpack.io/devbox/internal/devconfig/configfile" "go.jetpack.io/devbox/internal/devpkg" "go.jetpack.io/devbox/internal/devpkg/pkgtype" "go.jetpack.io/devbox/internal/envir" @@ -1009,9 +1010,9 @@ func (d *Devbox) configEnvs( } } else if d.cfg.Root.EnvFrom != "" { return nil, usererr.New( - "unknown from_env value: %s. Supported value is: %q.", + "unknown env_from value: %s. Supported values are: \"%q\" or a path to a file ending in \".env\"", d.cfg.Root.EnvFrom, - "jetpack-cloud", + configfile.JetifyCloudEnvFromValue, ) } for k, v := range d.cfg.Env() { diff --git a/internal/devconfig/configfile/env.go b/internal/devconfig/configfile/env.go index b34fb9e80c8..83161aed658 100644 --- a/internal/devconfig/configfile/env.go +++ b/internal/devconfig/configfile/env.go @@ -8,9 +8,11 @@ import ( "github.com/hashicorp/go-envparse" ) +var JetifyCloudEnvFromValue = "jetify-cloud" + func (c *ConfigFile) IsEnvsecEnabled() bool { // envsec for legacy. jetpack-cloud for legacy - return c.EnvFrom == "envsec" || c.EnvFrom == "jetpack-cloud" || c.EnvFrom == "jetify-cloud" + return c.EnvFrom == "envsec" || c.EnvFrom == "jetpack-cloud" || c.EnvFrom == JetifyCloudEnvFromValue } func (c *ConfigFile) IsdotEnvEnabled() bool {