Versions

Envless.versions.list_all_entries

Collect every version entry for rotation

def list_all_entries(
  project,
  environment,
  limit: nil,
  offset: nil,
  product: nil,
  timeout: nil
)

Walks every page and returns one array holding every version entry in the environment. This is the shape a rotation wants: decrypt each value and defaultValue with the old key, re-encrypt with the new one, then write the results back in batches through reencrypt_entries.

It holds the entire encrypted history of the environment in memory at once, and the server rebuilds that history on every request, so prefer iterate_entries on a large environment. limit: only sets the page size used while walking, clamped to 100, it does not cap how many entries come back.

Envless.rotate_workspace_passphrase already does this walk plus the re-encryption and the batched write back for both live variables and history, so call this directly only when you need a custom rotation.

Example

ruby
require "envless/sdk"

entries = Envless.versions.list_all_entries(
  "api",
  "production",
  product: "billing"
)

puts entries.count { |entry| entry[:value] }

Parameters

ParameterTypeRequiredDescription
projectStringYesProject slug or project uniqueId.
environmentStringYesEnvironment slug, since an environment uniqueId will not resolve here.
product:String | SymbolNoProduct slug used to disambiguate a project slug shared across products.
limit:IntegerNoPage size used while walking, clamped to 100.
offset:IntegerNoRow to start the walk from.
timeout:Integer | Float | RationalNoSeconds 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

Array[version_entry_resource] holding every entry across every version of the environment.

Reads the entries 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

  • Entries with a nil value do occur. Skip them instead of feeding them to a decrypt call.
  • Split the array into batches of at most 200 before writing it back, since a longer entries array is rejected with 400.

Required scopes

versions:read and variables:read

Underlying endpoint

GET /projects/{slug}/environments/{environmentSlug}/versions/entries

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

In TypeScript

envless.versions.listAllEntries()

The same method in @goenvless/sdk, with the same request, retries and errors.