Local secrets
The LPM CLI local vault stores project environment variables. It does not need an LPM.dev Registry account or a network connection.
lpm env set DATABASE_URL=postgres://localhost/app
lpm env get DATABASE_URL
lpm env list
Store and read values
set accepts one or more KEY=VALUE pairs:
lpm env set API_KEY=sk-local
lpm env set "GREETING=hello world" PORT=3000
lpm env set --env=staging API_KEY=sk-staging
If a key exists, set replaces its value.
By default, get and list mask the values:
lpm env get API_KEY
lpm env list
Add --reveal only when you want plaintext output:
lpm env get API_KEY --reveal
lpm env list --reveal
get --reveal prints the raw value. list --reveal prints every key and value in the selected environment.
To delete one or more values, run:
lpm env delete API_KEY
lpm env delete API_KEY DATABASE_URL
Import and export dotenv files
lpm env import .env
lpm env import .env.production --env=production
lpm env import .env --overwrite
An import skips keys that already exist. To replace them, add --overwrite. LPM CLI also adds the imported file to the project .gitignore.
An export writes plaintext:
lpm env export .env.backup
lpm env export .env.staging --env=staging
LPM CLI adds the output path to .gitignore before it writes the file. It writes the file atomically, with owner-only 0600 permissions on Unix. Treat the exported file as a secret, even though Git ignores it.
The dotenv parser reads assignments, comments, quoted values, and export KEY=VALUE lines. It does not expand $OTHER_VARIABLE references.
Print a resolved environment
lpm env print combines dotenv files, vault values, environment inheritance, and schema defaults. Its default format is dotenv:
lpm env print
lpm env print --env=staging
lpm env print --format=json
To load the values into the current shell, use the shell format:
eval "$(lpm env print --format=shell)"
lpm env print shows the values in plaintext, and eval puts them into your shell. Use lpm run or lpm dev instead when you can. These commands give the resolved environment directly to the child process.
Validate an environment schema
Define the schema under lpm.json > envSchema > vars:
{
"envSchema": {
"vars": {
"DATABASE_URL": {
"required": true,
"format": "url",
"secret": true
},
"PORT": {
"required": false,
"format": "port",
"default": "3000"
}
}
}
}
lpm env check
lpm env example
lpm env check validates every discovered environment against the schema. It reports missing required values, invalid formats, pattern failures, and other rule violations. To validate only one environment, add --env=<name>.
lpm env example writes .env.example. With --env=<name>, it writes .env.<name>.example instead.
LPM CLI also validates the resolved environment before lpm run, lpm dev, file execution, and lpm exec. To skip the value checks and the defaults for one run, add --no-env-check. An invalid schema declaration still stops the command.
The LPM CLI lpm.json reference explains every schema rule.
Initialize existing projects
lpm env init
lpm env ls
lpm env init reads the environment configuration and the conventional .env files. It imports each file into a vault environment that has no values yet. It does not change an environment that already has values. To replace those values too, add --force.
lpm env ls shows known environment names, stored-value counts, schema coverage, aliases, and the project-level cloud-sync status.
Where local data lives
| Platform | Local storage |
|---|---|
| macOS | Project vault data in Keychain under dev.lpm.vault |
| Linux | Encrypted file at ~/.lpm/vaults/<hash>.vault. Secret Service protects the data key when it is available. |
| Windows | Encrypted file at ~/.lpm/vaults/<hash>.vault. Credential Manager protects the data key when it is available. |
On Linux and Windows, <hash> is a SHA-256 hash of the vault ID. Older LPM CLI versions named the file <vault-id>.enc. LPM CLI still reads that file, and the next write replaces it with the new file. If the system credential store is not available, LPM CLI keeps the data key in the owner-only file ~/.lpm/.vault-fallback-key.
When LPM CLI creates a project vault, it records a stable identifier in lpm.json:
{
"vault": "7f3a1e2c-5b9d-4a8f-b6c1-9b1d2e3f4a5b"
}
The identifier only points to the vault. It is not a secret. Commit lpm.json, so that the project keeps the same vault identity after a move or a clone. If you remove the field, the next operation that needs a vault creates a new identity. That operation does not delete the previous local or cloud data.
Upgrade existing env schemas
If the project metadata is invalid, the encrypted values still sync. LPM.dev Registry drops each invalid environment entry and the environments that inherit from it. If the envSchema and envSchemaConfig pair is invalid, LPM.dev Registry keeps the last valid pair.
After a successful personal or organization push, LPM CLI v0.81.0 and later show an env_metadata_dropped warning. In JSON output, each metadata warning has code, message, and hint fields. LPM CLI v0.79.0 and app v1.0.1 sync the values, but they do not show this warning. The project dashboard shows a recovery banner, whichever client pushed. The activity log records the reason, the time, and the client version, but not the rejected values.
To correct the metadata, do these steps:
- Update LPM CLI or the app.
- For a public framework prefix such as
VITE_, addclient: trueto the rule. - For a secret rule, remove the
defaultandenumliterals fromlpm.json. - Keep secret values in the encrypted environment.
- Use environment names and aliases with ASCII letters, numbers, hyphens, underscores, or dots, up to 64 characters.
- Do not use the reserved name
__index__or two consecutive dots in an environment name. - Remove control characters from environment file paths.
- Correct invalid patterns, empty enums, default values that fail their rules, and incompatible bounds.
- Run
lpm env checkwith the updated client. - Push again to update the metadata and clear the warning.
An update of the client does not change the declarations in lpm.json. Authorization failures, invalid ciphertext, and revision conflicts still block a write.
See also
- Per-environment scoping explains how to keep development, staging, and production values apart.
- Cloud sync explains how LPM CLI encrypts and syncs the complete project vault.
- The LPM CLI environment reference describes every command and its output.