ray diff
Compare secret keys and values across environments to detect configuration drift
Compare secret keys and values across environments to detect configuration drift
Synopsis
ray diff [options] [env1] [env2]Positional Arguments
| Argument | Required | Description |
|---|---|---|
[env1] | Optional | Source environment to compare from |
[env2] | Optional | Target environment to compare against |
Flags & Options
| Flag / Option | Type | Description |
|---|---|---|
-p, --project <id_or_name> | string | Target project ID or slug to link or query, bypassing interactive selection |
-e, --env <name>(--environment <name>) | string | Target environment name (e.g. development, staging, production) to read or modify |
-s, --scope <path> | string | Subdirectory path or workspace scope to target instead of auto-detecting from the working directory (e.g. apps/web or packages/backend) |
--reveal | boolean | Display plaintext secret values in the terminal table instead of masking characters |
--search <query>(--query <query>) | string | Filter secret keys by case-insensitive substring match (e.g. --search DB_) |
--diff-only | boolean | Display only secrets with conflicting or missing values, hiding secrets that match identically |
-b, --base(-t, --team) | boolean | Fetch canonical team environment secrets, ignoring personal workstation overrides (recommended for CI/CD) |
--strict(--exit-code) | boolean | Abort execution immediately with an exit code if any required secret is missing, empty, or drifting |
-q, --quiet | boolean | Silence banners, progress spinners, and status output; only print process output and critical errors |
--offline | boolean | Run using encrypted local disk cache without connecting to the remote Ray Secrets API server |
--ci | boolean | Optimize execution for headless CI/CD runners (disables spinners, prompts, colors, and update checks) |
--json | boolean | Format command output as structured JSON for scripting, automation, and piping |
Common Examples
1. Compare workstation overrides against team base environment
Detects differences between your local personal overrides and the canonical team environment.
ray diff2. Compare secret keys and values between two environments
Highlights missing keys, modified values, and identical secrets across two environments.
ray diff development staging3. Display only differing or missing keys, hiding identical secrets
Filters the diff view to highlight only configuration drift and discrepancies.
ray diff development production --diff-only4. Enforce zero-drift policy in CI runners
Exits with non-zero status code if any drift or missing secrets are detected between environments.
ray diff staging production --strict --ci5. Compare environments with revealed plaintext differences
Displays exact character differences between secret values in both environments.
ray diff development staging --revealExit Codes
| Code | Meaning | Recommended Action |
|---|---|---|
| 0 | Success. The command completed with no errors. | None required. |
| 1 | Runtime or execution failure. A child process returned non-zero status or a general error occurred. | Inspect process output or run with --verbose. |
| 2 | Authentication failed. Token is missing, expired, or invalid. | Run `ray login` or update `RAY_TOKEN`. |
| 3 | Configuration or binding error. Project or environment context was not found. | Run `ray init` or specify `--project` and `--env`. |
| 4 | Network or API failure. Failed to reach the Ray Secrets vault. | Check internet connection or run `ray doctor`. |
Ready to eliminate plaintext secrets?
Create a workspace to organize environments, invite your team, and generate scoped Service Tokens for CI/CD.