What are secrets?
Secrets are encrypted environment variables that you access at runtime throughctx.env. Use them for API keys, database URLs, external service tokens, and any sensitive values.
Configure secrets
You have three ways to configure secrets with the CLI:- Inline
- .env file
- Interactive
Pass
KEY=VALUE pairs directly:UPPER_SNAKE_CASE (pattern: ^[A-Z][A-Z0-9_]*$).
Access secrets in your function
Usectx.env inside the handler:
index.ts
ctx.env methods
| Method | Returns | Description |
|---|---|---|
ctx.env.get("KEY") | string | undefined | Gets the value of a secret |
ctx.env.has("KEY") | boolean | Checks if a secret exists |
ctx.env.toObject() | Record<string, string> | Gets all secrets as an object |
Blocked variables
Internal platform variables with the__FN_ prefix are blocked. Calling ctx.env.get("__FN_COMPANY_ID") returns undefined.
Local development
In local development, thejelou functions dev server loads secrets from your .env file:
.env
List and delete secrets
Secrets in CI/CD
In CI pipelines, use system environment variables to inject secrets:deploy.yml