Skip to content

Manage the shared store with apify env #1580

Open

Description

@DaveHanns

With this issue, the apify env commands manage the shared store: the list of shared variables of an account, which Actor versions reference from their env vars. The store changes six commands (ls, set, rm, pull, diff, and push) and adds one (link). This issue covers ls, set, and rm with a --store flag, and the commands for references follow in #1648 and #1649.

Scope

  • Add --store to apify env ls, set, and rm. With it, the command manages the account's shared variables instead of the Actor's. Proposed name: --store, because a "global" flag can be read as either per Actor or per organization. The store Epic lists the CLI naming as an open decision. Close it before this issue starts.
  • Work on the account that the CLI is logged in to. The CLI logs in with an OAuth access token by default, so the store has to accept such a token (apify/apify-core#32548). A command with --store needs no Actor: it doesn't read .actor/actor.json, and --dir, --actor, and --version can't be combined with it.
  • List each shared variable's name, type (secret or plain), and description with apify env ls --store, and the value of a plain variable. A secret's value stays hidden, as in apify env ls. The --json output has the same fields.
  • Print what the API returns to the caller. An organization member who can edit Actors but lacks the permission to manage the store gets names, types, and descriptions, and no values, not even of plain variables (proposed). For such a member, ls --store prints the list without values, and set --store and rm --store fail with the API's error. A scoped API token has no access to the store in the first version (proposed).
  • Create a shared variable with apify env set <name> --store, or update the value of an existing one. The value comes from a prompt or standard input, never from an argument, as in apify env set. Proposed: a new shared variable is a secret unless --no-secret is passed, the same default as in Console, the API, and the MCP tools. An existing variable keeps its type unless --secret or --no-secret is passed. Without --store, apify env set creates a plain variable unless --secret is passed, so the help of the flag has to name both defaults.
  • Delete a shared variable with apify env rm <name> --store. The command asks for confirmation and fails on a name that doesn't exist, as apify env rm does.
  • Make rm --store on a referenced variable fail with the list of Actors, unless --force is passed. The API refuses such a delete, and the list comes from the usage endpoint: each Actor with its versions and the env var's name in each version. Show the first page of Actors and their total number. The message says how to go on: remove the references and rebuild those Actors, or pass --force.
  • Send force=true with --force. The command then shows the same list as a warning, says that runs of those Actors fail to start once the variable is gone, and deletes the variable. --yes skips only the confirmation prompt and doesn't replace --force.
  • Print no rebuild reminder (printRebuildReminder in src/lib/env-vars/output.ts) after set --store and rm --store: it's for changes to an Actor version. After set --store, say that runs read the value when they start, so the change needs no rebuild. When the command replaced an existing value, add that the change reaches every Actor that references the variable and that the previous value isn't kept.
  • Describe --store in the env var guide (docs/vars.md) and regenerate the command reference (docs/reference.md).

This can ship as two pull requests: ls --store first, then set --store and rm --store.

Rollout

The CLI can be released with --store before the store is released to every account (apify/apify-core#33725). Until then, the API refuses an account without the feature flag of the store, and the commands print that error.

Done when

  • Local tests (test/local/commands/env/) cover the three commands with --store: a new variable is a secret by default, a list without values prints no values, and rm --store on a referenced variable fails with the list of Actors and deletes the variable with --force.
  • The output of set --store never contains the value, not even in an error.

Depends on

Activity

  1. added theissue type on Nov 11, 2026
  2. added
    t-builders
    on Nov 11, 2026
  3. changed the title [-]Support the shared store in `apify env`[/-] [+]Manage the shared store with `apify env`[/+] on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-builders

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions