Skip to content

feat: Reorganize environment variables documentation for clarity#2515

Open
jancurn wants to merge 16 commits into
masterfrom
claude/clarify-env-vars-docs-nrFCt
Open

feat: Reorganize environment variables documentation for clarity#2515
jancurn wants to merge 16 commits into
masterfrom
claude/clarify-env-vars-docs-nrFCt

Conversation

@jancurn
Copy link
Copy Markdown
Member

@jancurn jancurn commented May 8, 2026

Summary

Clarify the environment variables page by separating run-time from build-time and system from custom.

  • Split intro into two sources: System and Custom environment variables
  • Call out that system variables are run-time only and never passed to builds, even with Apply environment variables also to the build process enabled
  • Group setup methods under Custom environment variables with shorter subsection titles: Define in actor.json and Define in Apify Console
  • Extract Secret option and visibility caution into a dedicated Secure environment variables subsection
  • Expand Build-time environment variables to explain the Console opt-in and that only custom variables are forwarded

https://claude.ai/code/session_0121d3Sgy1UxMnpVZzBEQCNA

claude added 2 commits May 8, 2026 13:55
Make explicit that system env vars apply only to Actor runs, not builds.
Document that "Apply environment variables also to the build process"
forwards only user-defined variables, never the Apify system ones.
Move the actor.json and Apify Console setup sections plus the
Configuration class section under a new "Custom environment variables"
heading, separating user-defined variables from system ones.
@jancurn jancurn changed the title Reorganize environment variables documentation for clarity feat: Reorganize environment variables documentation for clarity May 8, 2026
@jancurn jancurn added t-docs Issues owned by technical writing team. adhoc Ad-hoc unplanned task added during the sprint. and removed t-docs Issues owned by technical writing team. labels May 8, 2026
@apify-service-account
Copy link
Copy Markdown
Contributor

apify-service-account commented May 12, 2026

✅ Preview for this PR (commit 1326bd49) is ready at https://pr-2515.preview.docs.apify.com (see action run).

jancurn and others added 5 commits May 18, 2026 23:12
- Shorten run-time-only callout and intro
- Rename "Set up environment variables in ..." subsections to "Define in ..."
- Move Secret / visibility content into its own "Secure environment variables" subsection
@jancurn jancurn marked this pull request as ready for review May 20, 2026 12:47
@jancurn jancurn requested review from TC-MO and Copilot May 20, 2026 12:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reorganizes the Actor environment variables documentation to clearly separate system vs. custom variables and run-time vs. build-time behavior, including security guidance for secrets.

Changes:

  • Reworked the introduction to distinguish system and custom environment variables and clarify run/build scope.
  • Restructured custom variable setup into actor.json, Console, and a dedicated “Secure environment variables” subsection.
  • Expanded build-time coverage to explain the Console opt-in and that only custom variables are forwarded.
Comments suppressed due to low confidence (3)

sources/platform/actors/development/programming_interface/environment_variables.md:21

  • Docs standards in AGENTS.md say bold should be reserved for UI elements only. Here run and build are conceptual terms (not UI labels), so they should not be bolded; use plain text (and keep bold only for actual UI items like button/menu names).
By default, both kinds of variables are passed only to the Actor **run**, not to the **build**. For variables passed to the build process (Docker build arguments), see [Build-time environment variables](#build-time-environment-variables).

sources/platform/actors/development/programming_interface/environment_variables.md:112

  • The JSON example is not valid JSON because it has a trailing comma after the last property ("MYSQL_USER": "my_username",). Since the code fence is marked as json, please make the snippet valid JSON (remove the trailing comma or add another property).
```json
{
  "actorSpecification": 1,
  "name": "dataset-to-mysql",
  "version": "0.1",
  "buildTag": "latest",
  "environmentVariables": {
    "MYSQL_USER": "my_username",
  }
}

sources/platform/actors/development/programming_interface/environment_variables.md:242

  • Docs standards in AGENTS.md say bold should be reserved for UI elements only. In this paragraph, runs and build are concepts, so remove the bold emphasis (while keeping bold for UI labels like Apply environment variables also to the build process).
The environment variables described above apply only to Actor **runs**. To make a variable available during the Actor's **build** process, you need to opt in explicitly. In this case, the variables function as Docker build arguments. To use them in your Dockerfile, include the `ARG` instruction:

jancurn and others added 2 commits May 20, 2026 14:52
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@TC-MO TC-MO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: the customer > custom typo at L98.

The other suggestions on new/changed prose (L9, L29, L88) would be good to address while you're in here.

I've also flagged a handful of cleanup opportunities on pre-existing lines.
Feel free to fold them in, or leave them for a follow-up.

---

**Learn how to provide your Actor with context that determines its behavior through a plethora of pre-defined environment variables set by the Apify platform.**
**Learn how your Actors get runtime context from environment variables - either set by the Apify platform or defined by you.**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would actually remove this whole intro, we've been already doing it in other parts of docs. It brings little to no additional value, and just repeats description.


:::

Here's a table of key system environment variables:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this sentence, clean up opportunity


Once a build starts, its environment variables are frozen into that build's Docker image. To change them, you need to create a new build. Learn more in [Builds](../builds_and_runs/builds.md).

By leveraging environment variables effectively, you can create more flexible and configurable Actors that adapt to different execution contexts and user requirements.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove sentence - clean up opportunity.

Comment on lines +96 to +102
:::info Build-time variables

Once an Actor is built, the customer environment variables are baked in and cannot be changed.
To use different variables, you must create a new build.

Learn more in [Builds](../builds_and_runs/builds.md).
:::
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This admonition serves the same info as the ending of the doc at L261. I would propose to drop this completely fixing duplication issue & the typo at the same time. The ending seems like a more natural fit for this statement either way.

jancurn and others added 6 commits May 21, 2026 16:07
…ronment_variables.md

Co-authored-by: Michał Olender <92638966+TC-MO@users.noreply.github.com>
…ronment_variables.md

Co-authored-by: Michał Olender <92638966+TC-MO@users.noreply.github.com>
…ronment_variables.md

Co-authored-by: Michał Olender <92638966+TC-MO@users.noreply.github.com>
…ronment_variables.md

Co-authored-by: Michał Olender <92638966+TC-MO@users.noreply.github.com>
…ronment_variables.md

Co-authored-by: Michał Olender <92638966+TC-MO@users.noreply.github.com>
- Remove duplicate bold lead-in (already in page description)
- Drop "Here's a table" filler sentence
- Drop duplicated build-time admonition (same info appears in build-time section)
- Remove closing "By leveraging..." sentence
@jancurn jancurn requested a review from TC-MO May 21, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants