Skip to content

Load .env in apify run #1569

Open
Open

Description

@DaveHanns

apify run reads local values only from environmentVariables in actor.json. .env is the format the rest of the industry uses, and it becomes the recommended place for local env vars.

Scope

  • Read .env from the Actor directory (next to .actor/) when it exists, and add its values to the run environment (src/commands/run.ts).
  • Parse it with Node's built-in util.parseEnv. The CLI requires Node.js 22, so no new dependency is needed.
  • Apply this precedence, lowest to highest: shell environment, variables the CLI sets for the run, environmentVariables from actor.json, .env. Only the last step is new.
  • Treat values as literal. @secret references aren't resolved in .env.

Out of scope

  • The deprecation warning for environmentVariables. It has its own issue.

Done when

  • Tests cover the precedence order and a run without .env.

Depends on

Activity

  1. added theissue type on Nov 11, 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-buildersIssues owned by the Builders team.

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions