Skip to Content
RcmadeDocs
Ray SecretsReferenceCLI ReferenceSecrets

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

ArgumentRequiredDescription
[env1]OptionalSource environment to compare from
[env2]OptionalTarget environment to compare against

Flags & Options

Flag / OptionTypeDescription
-p, --project <id_or_name>stringTarget project ID or slug to link or query, bypassing interactive selection
-e, --env <name>(--environment <name>)stringTarget environment name (e.g. development, staging, production) to read or modify
-s, --scope <path>stringSubdirectory path or workspace scope to target instead of auto-detecting from the working directory (e.g. apps/web or packages/backend)
--revealbooleanDisplay plaintext secret values in the terminal table instead of masking characters
--search <query>(--query <query>)stringFilter secret keys by case-insensitive substring match (e.g. --search DB_)
--diff-onlybooleanDisplay only secrets with conflicting or missing values, hiding secrets that match identically
-b, --base(-t, --team)booleanFetch canonical team environment secrets, ignoring personal workstation overrides (recommended for CI/CD)
--strict(--exit-code)booleanAbort execution immediately with an exit code if any required secret is missing, empty, or drifting
-q, --quietbooleanSilence banners, progress spinners, and status output; only print process output and critical errors
--offlinebooleanRun using encrypted local disk cache without connecting to the remote Ray Secrets API server
--cibooleanOptimize execution for headless CI/CD runners (disables spinners, prompts, colors, and update checks)
--jsonbooleanFormat 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 diff

2. Compare secret keys and values between two environments

Highlights missing keys, modified values, and identical secrets across two environments.

ray diff development staging

3. 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-only

4. 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 --ci

5. Compare environments with revealed plaintext differences

Displays exact character differences between secret values in both environments.

ray diff development staging --reveal

Exit Codes

CodeMeaningRecommended Action
0Success. The command completed with no errors.None required.
1Runtime or execution failure. A child process returned non-zero status or a general error occurred.Inspect process output or run with --verbose.
2Authentication failed. Token is missing, expired, or invalid.Run `ray login` or update `RAY_TOKEN`.
3Configuration or binding error. Project or environment context was not found.Run `ray init` or specify `--project` and `--env`.
4Network 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.