Variables

Envless.variables.delete

Soft delete one variable by name

def delete(project, environment, name, product: nil, timeout: nil)

Soft deletes one live variable by name, matched without regard to case, so api_key removes a live API_KEY. It stops appearing in reads immediately, but version snapshots taken before the delete keep their copy, so a rollback can bring the variable back.

Deleting a name that is not there is a 404, not a no-op, which makes a blind retry after a successful delete fail. Use delete_many when you want unknown names tolerated.

Example

ruby
require "envless/sdk"

removed = Envless.variables.delete(
  "api",
  "production",
  "LEGACY_API_URL"
)

puts "#{removed[:id]} #{removed[:environmentId]}"

Parameters

ParameterTypeRequiredDescription
projectStringYesProject slug the environment belongs to.
environmentStringYesEnvironment slug the variable lives in.
nameStringYesVariable name, matched without regard to case.
product:String | SymbolNoProduct slug, needed when the project slug is not unique in the workspace.
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

deleted_variable_resource with the id, name and environmentId of the removed row.

Worth knowing

  • The name is freed for reuse right away, in any casing, but a new variable of that name gets a new id and an empty history.

Required scopes

variables:write

Underlying endpoint

DELETE /projects/{slug}/environments/{environmentSlug}/variables/{name}

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

In TypeScript

envless.variables.delete()

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