def list(
project,
environment,
limit: nil,
offset: nil,
product: nil,
timeout: nil
)def list: (
String project,
String environment,
?limit: Integer?,
?offset: Integer?,
?product: (String | Symbol)?,
?timeout: seconds?
) -> Page[variable_resource]Fetches one page of the variables in an environment, sorted by name A to Z. Soft deleted variables are excluded.
Every value and defaultValue comes back as ciphertext, because the server holds no key material and cannot decrypt anything. Run each one through decrypt_value with the workspace passphrase and the workspaceId from Envless.me.get. Rows written before ciphertext was enforced can still hold plaintext, so test with ciphertext? rather than reading a failed decrypt as corruption. Pagination is limit and offset only, and a limit above 100 is rejected with 400 request.invalid_pagination rather than clamped.
Example
require "envless/sdk"
page = Envless.variables.list("api", "production", limit: 50)
puts page.pagination[:totalCount]
puts page.items.map { |variable| variable[:name] }Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project | String | Yes | Project slug the environment belongs to. |
environment | String | Yes | Environment slug to read variables from. |
limit: | Integer | No | Page size between 1 and 100. |
offset: | Integer | No | Number of variables to skip before the page starts. |
product: | String | Symbol | No | Product slug, needed when the project slug is not unique in the workspace. |
timeout: | Integer | Float | Rational | No | Seconds each attempt of this call may take, redirects and the response body included, before it raises Envless::NetworkError with timeout? set. Overrides the client's timeout for this call, and 0 turns the limit off. |
Returns
Page[variable_resource] holding items plus a pagination envelope with totalCount and hasMore.
Reads the variables collection. list returns one page as an Envless::Page with items and pagination, list_all collects every page into an array, and iterate yields one item at a time to a block, fetching the next page only when it gets there. Without a block, iterate returns an Enumerator.
Worth knowing
- A project locked by the workspace plan refuses reads as well as writes, with 402
plan.upgrade_required. - A duplicate project slug across two products is 409
project.ambiguous_product. Retry withproduct:.
Required scopes
variables:read
Underlying endpoint
GET /projects/{slug}/environments/{environmentSlug}/variables
Request and response schema, every error code, and a live playground.
In TypeScript
envless.variables.list()
The same method in @goenvless/sdk, with the same request, retries and errors.