Configuration Resolution
The CLI resolves settings from multiple sources, with higher-priority sources overriding lower ones.
Organization, project, and environment
For org, project, and env (used by pull, push, run, and listing commands):
| Priority | Source |
|---|---|
| 1 (highest) | CLI flags (-o, -p, -e) |
| 2 | ENVSHED_ENV environment variable (env only) |
| 3 | Project config (.envshed.json) |
The ENVSHED_ENV variable lets you override the environment without passing -e on every call. This is useful in CI/CD pipelines or shell profiles:
export ENVSHED_ENV=staging
envshed pull # pulls from "staging" without -e
envshed run -- npm start
The -e flag always takes precedence over ENVSHED_ENV.
If a required value is missing from all sources, the command exits with an error.
API URL
| Priority | Source |
|---|---|
| 1 (highest) | --api-url flag (on login and init) |
| 2 | apiUrl in .envshed.json |
| 3 | apiUrl in ~/.envshed/config.json |
| 4 | ENVSHED_API_URL environment variable |
| 5 (lowest) | Default: https://app.envshed.com |
Authentication token
| Priority | Source |
|---|---|
| 1 (highest) | ENVSHED_TOKEN environment variable |
| 2 | token in ~/.envshed/config.json |
There is no flag to pass a token per-command. Use envshed login, envshed token set, or set the ENVSHED_TOKEN environment variable.
Working directory
When running the CLI via pnpm --filter, the working directory changes to the package directory. The CLI uses the INIT_CWD environment variable (set automatically by pnpm/npm) to resolve file paths and find .envshed.json from the original directory.