Variables

envless.variables.listAll()

Collect every variable in an environment

ts
listAll(project: string, environment: string, options?: ScopedListOptions): Promise<Array<VariableResource>>

Walks every page and resolves a single array of the live variables in an environment. Requests run one after another until hasMore turns false, so a large environment costs one round trip per 100 variables and the entire set is held in memory at once.

options.limit is the page size here, not a total cap, and it is clamped to 100. options.offset sets where the walk starts, so a non-zero value silently drops the variables before it.

There is no partial result. A rejection midway through the walk discards the pages already fetched, so budget for the whole thing succeeding or nothing.

Example

ts
const variables = await envless.variables.listAll('api', 'production')

console.log(variables.length)

Parameters

ParameterTypeRequiredDescription
projectstringYesProject slug the environment belongs to.
environmentstringYesEnvironment slug to read variables from.
options.limitnumberNoPage size for each underlying request, clamped to 100.
options.offsetnumberNoOffset the walk starts from, defaults to 0.
options.productstringNoProduct slug, needed when the project slug is not unique in the workspace.
options.signalAbortSignalNoCancels every request in the walk.

Returns

Array<VariableResource> with every live variable in the environment, values still ciphertext.

Reads the variables collection. list returns one page as { items, pagination }, listAll collects every page into an array, and iterate streams one item at a time without buffering the whole set.

Worth knowing

  • Use this to build the baseline for apply, since the drift check needs every live variable and not just a page.

Required scopes

variables:read

Underlying endpoint

GET /projects/{slug}/environments/{environmentSlug}/variables

Request and response schema, every error code, and a live playground.

In Python

envless.variables.list_all()

The same method in envless-sdk, the Python SDK, with the same request, retries and errors.

In Ruby

Envless.variables.list_all

The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.

In PHP

$envless->variables->listAll()

The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.