pocketenv/env

Manage environment variables attached to a sandbox.

Variables are plain-text key/value pairs injected into the sandbox at runtime. For sensitive data prefer pocketenv/secrets.

Types

A single environment variable stored in a sandbox.

pub type Variable {
  Variable(
    id: String,
    name: String,
    value: String,
    created_at: String,
  )
}

Constructors

  • Variable(
      id: String,
      name: String,
      value: String,
      created_at: String,
    )

Values

pub fn delete(
  sb: sandbox.ConnectedSandbox,
  id: String,
) -> Result(Nil, pocketenv.PocketenvError)

Deletes the environment variable identified by id.

pub fn list(
  sb: sandbox.ConnectedSandbox,
  limit: option.Option(Int),
  offset: option.Option(Int),
) -> Result(List(Variable), pocketenv.PocketenvError)

Lists environment variables for the sandbox. Optionally paginate with limit and offset.

Example

let assert Ok(vars) = sb |> env.list(None, None)
pub fn put(
  sb: sandbox.ConnectedSandbox,
  name: String,
  value: String,
) -> Result(Nil, pocketenv.PocketenvError)

Creates or updates an environment variable named name with value.

Example

let assert Ok(Nil) = sb |> env.put("PORT", "8080")
pub fn variable_decoder() -> decode.Decoder(Variable)

JSON decoder for Variable.

Search Document