Rayfin

rayfin secret

Command reference for setting, listing, deleting, describing, bulk importing, and typing Rayfin secrets for Functions.

Changed in 1.36

rayfin secret manages secret values stored on the deployed Fabric app. Functions read declared secrets through typed ctx.Secrets.<NAME> properties.

rayfin secret set

npx rayfin secret set [name] [--describe="description"] [--stdin]
npx rayfin secret set --env-file <path>
Argument or optionDescription
[name]Secret name for a single-secret set. Required unless --env-file is used.
--describe [description]Description for this secret in rayfin/rayfin.yml; must use equals syntax: --describe="My description".
--stdinRead one secret value from stdin instead of prompting.
--env-file <path>Set multiple secrets from a dotenv file.

For a single secret without --stdin, the CLI prompts with masked input. With --describe, the description is stored with the name in rayfin.yml:

rayfin/rayfin.yml
secrets:
  - name: OPENAI_KEY
    description: OpenAI API key for summarizeText

The secret value is never written to rayfin.yml.

After a successful set, the CLI records each secret name in rayfin.yml and regenerates secrets.generated.ts in the src/ folder of the functions package โ€” services.functions.path, so rayfin/functions/src/ by default โ€” printing the path when the file changes. --env-file does this for every name in the file, without descriptions. Changed in 2.0

Example interactive output for a new secret:

๐Ÿ“ Added secret metadata for "OPENAI_KEY" to rayfin/rayfin.yml
๐Ÿงฌ Updated secret types in rayfin/functions/src/secrets.generated.ts
โœ… Secret "OPENAI_KEY" set successfully (updated: 10/3/2026, 4:10:00 PM)

Example JSON output:

{
  "status": "success",
  "name": "OPENAI_KEY",
  "createdAt": "2026-10-03T23:10:00.000Z",
  "updatedAt": "2026-10-03T23:10:00.000Z"
}

Example output for --env-file:

โœ… Secrets applied (2/2 uploaded)
๐Ÿ“ Added secret metadata for 2 secret(s) to rayfin/rayfin.yml
๐Ÿงฌ Updated secret types in rayfin/functions/src/secrets.generated.ts

With --json, --env-file returns { "status": "success", "count": <n>, "secrets": [...] }, with the same name, createdAt, and updatedAt fields per secret.

Deployed functions can cache secret values for a few minutes, so a new value can take a few minutes to reach them. Changed in 2.0

rayfin secret list

npx rayfin secret list
npx rayfin --json secret list

Lists secret names and timestamps only. Values are never returned.

Example interactive output:

๐Ÿ“‹ Secrets (2):

  Name:         OPENAI_KEY
  Created:      10/3/2026, 4:10:00 PM
  Last Updated: 10/3/2026, 4:10:00 PM

  Name:         DATABASE_PASSWORD
  Created:      10/3/2026, 4:12:00 PM
  Last Updated: 10/3/2026, 4:12:00 PM

Example JSON output:

{
  "status": "success",
  "count": 2,
  "secrets": [
    {
      "name": "OPENAI_KEY",
      "createdAt": "2026-10-03T23:10:00.000Z",
      "updatedAt": "2026-10-03T23:10:00.000Z"
    },
    {
      "name": "DATABASE_PASSWORD",
      "createdAt": "2026-10-03T23:12:00.000Z",
      "updatedAt": "2026-10-03T23:12:00.000Z"
    }
  ]
}

When scripting, use --json. Plain text is intended for interactive terminals.

rayfin secret delete

npx rayfin secret delete <name>
npx rayfin secret delete <name> --yes
Argument or optionDescription
<name>Secret to delete.
-y, --yesSkip the confirmation prompt.

Delete removes the remote value, removes the metadata entry from rayfin.yml, and regenerates secrets.generated.ts.

Dotenv import rules

--env-file reads KEY=VALUE entries. Blank lines and # comments are ignored. Surrounding single or double quotes are stripped from values. Names are used verbatim; there is no prefix convention.

rayfin/.env.secrets
OPENAI_KEY=sk-authoring-value
DATABASE_PASSWORD='quoted-value'

Do not commit dotenv files that contain secrets.

A name that is not a valid TypeScript identifier, such as 1PASSWORD_TOKEN, is quoted in secrets.generated.ts so the functions project still compiles; functions read it as ctx.Secrets['1PASSWORD_TOKEN']. Changed in 2.0

Output and global flags

Use root/global flags before or after the command as supported by Commander:

npx rayfin --json secret list
npx rayfin secret set OPENAI_KEY --stdin --json

secret list, secret set, and secret delete emit JSON envelopes when --json is set.

Errors

Error textCause
โŒ --describe requires the = syntax: --describe="My description"--describe was passed without equals syntax.
โŒ --stdin and --env-file cannot be used togetherChoose one input source.
โŒ Do not pass <name> with --env-fileBulk import uses names from the file.
โŒ Secret name is required when using --stdinPass rayfin secret set <NAME> --stdin.
โŒ Secret name is requiredPass a name or --env-file.
โŒ Secret set requires interactive inputStdin is not a TTY or CI=true; pass the value with --stdin.
โŒ No remote endpoint configuredRun npx rayfin up first.
โŒ Env file not found: <path>Fix the dotenv file path.
โŒ No KEY=VALUE entries found in <path>Add at least one dotenv entry.
No secret value was provided on stdin.Stdin was empty or whitespace.
โŒ Secret "<name>" was not found. It may already be deleted, or secret management may not be enabled for this item.The remote endpoint returned 404 for delete.
PromptManage Rayfin secrets with the CLI
In my Rayfin 2.0 project, manage a secret named <NAME> with `rayfin secret`. Confirm the app has an active deployment. Set the secret using `npx rayfin secret set <NAME> --describe="<purpose>"` or, for automation, `printf '%s' "$VALUE" | npx rayfin secret set <NAME> --stdin`. To set several at once, use `npx rayfin secret set --env-file <path>` with a dotenv file that is not committed. Never print or store the secret value. Verify with `npx rayfin --json secret list`, and confirm the name is in rayfin/rayfin.yml and in secrets.generated.ts in the functions package's src/ folder. If I ask to remove it, run `npx rayfin secret delete <NAME> --yes` and confirm rayfin/rayfin.yml and secrets.generated.ts no longer advertise it.
Something wrong on this page?Report an issueEdit this page

On this page