From c268d874ce1ab88d71a02de8dc098fdbd2cf6794 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 8 May 2026 13:55:07 +0000 Subject: [PATCH 01/14] docs: clarify run-time vs build-time environment variables 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. --- .../environment_variables.md | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index fbe5192c0c..e506dd031c 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -26,15 +26,23 @@ Your local `.actor/actor.json` file overrides variables set in Apify Console. To ::: +By default, the environment variables you define are passed only to the Actor **run**, not to the **build**. This page covers run-time environment variables; for variables passed to the build process (Docker build arguments), see [Build-time environment variables](#build-time-environment-variables). + Check out how you can [access environment variables in Actors](#access-environment-variables). ## System environment variables Apify sets several system environment variables for each Actor run. These variables provide essential context and information about the Actor's execution environment. +:::info Run-time only + +System environment variables are set only when the Actor runs. They are not available during the build process, even if you enable **Apply environment variables also to the build process** in the Actor's **Code** > **Environment variables** section. That option only forwards user-defined environment variables to the build; system variables such as `ACTOR_RUN_ID`, `APIFY_TOKEN`, or `ACTOR_DEFAULT_DATASET_ID` are never passed to builds. + +::: + Here's a table of key system environment variables: -| Environment Variable | Description | +| Environment variable | Description | | -------------------- | ----------- | | `ACTOR_ID` | ID of the Actor. | | `ACTOR_FULL_NAME` | Full technical name of the Actor, in the format `owner-username/actor-name`. | @@ -221,17 +229,27 @@ async def main(): ## Build-time environment variables -You can also use environment variables during the Actor's build process. In this case, they function as Docker build arguments. To use them in your Dockerfile, include `ARG` instruction: +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: ```docker ARG MY_BUILD_VARIABLE RUN echo $MY_BUILD_VARIABLE ``` +To pass your user-defined environment variables to the build, enable **Apply environment variables also to the build process** in your Actor's **Code** > **Environment variables** section in Apify Console. + +:::caution Only user-defined variables are passed to the build + +Even with **Apply environment variables also to the build process** enabled, only the variables you define in the Actor's **Environment variables** section are forwarded to the build. The Apify [system environment variables](#system-environment-variables) (such as `ACTOR_RUN_ID`, `APIFY_TOKEN`, or `ACTOR_DEFAULT_DATASET_ID`) are never available at build time, since the build is not associated with a specific run. + +::: + :::caution Variables set during the build Build-time environment variables are not suitable for secrets, as they are not encrypted. ::: +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. From 65fe98fd8de9f24d1eb18eebdd26b1ce14933253 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 8 May 2026 13:57:41 +0000 Subject: [PATCH 02/14] docs: group setup steps under "Custom environment variables" 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. --- .../environment_variables.md | 95 ++++++++++--------- 1 file changed, 51 insertions(+), 44 deletions(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index e506dd031c..41319b7d33 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -15,18 +15,12 @@ import TabItem from '@theme/TabItem'; ## How to use environment variables in an Actor -You can set up environment variables for your Actor in two ways: +Environment variables come from two sources: -- [Set up environment variables in `actor.json`](#set-up-environment-variables-in-actorjson) -- [Set up environment variables in Apify Console](#set-up-environment-variables-in-apify-console) - -:::info Environment variable precedence - -Your local `.actor/actor.json` file overrides variables set in Apify Console. To use Console variables, remove the `environmentVariables` key from the local file. - -::: +- [System environment variables](#system-environment-variables) - set automatically by the Apify platform for each Actor run. +- [Custom environment variables](#custom-environment-variables) - defined by the Actor owner, either in `.actor/actor.json` or in Apify Console. -By default, the environment variables you define are passed only to the Actor **run**, not to the **build**. This page covers run-time environment variables; for variables passed to the build process (Docker build arguments), see [Build-time environment variables](#build-time-environment-variables). +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). Check out how you can [access environment variables in Actors](#access-environment-variables). @@ -91,7 +85,20 @@ All date-related variables use the UTC timezone and are in [ISO 8601](https://en ::: -## Set up environment variables in `actor.json` +## Custom environment variables + +Actor owners can define custom environment variables to pass additional configuration to their Actors. There are two ways to set them up: + +- [Set up environment variables in `actor.json`](#set-up-environment-variables-in-actorjson) +- [Set up environment variables in Apify Console](#set-up-environment-variables-in-apify-console) + +:::info Environment variable precedence + +Your local `.actor/actor.json` file overrides variables set in Apify Console. To use Console variables, remove the `environmentVariables` key from the local file. + +::: + +### Set up environment variables in `actor.json` Actor owners can define custom environment variables in `.actor/actor.json`. All keys from `environmentVariables` will be set as environment variables into the Apify platform after you push Actor to Apify. @@ -113,9 +120,9 @@ Be aware that if you define `environmentVariables` in `.actor/actor.json`, it on ::: -## Set up environment variables in Apify Console +### Set up environment variables in Apify Console -Actor owners can define custom environment variables to pass additional configuration to their Actors. To set custom variables: +To set custom variables in Apify Console: 1. Go to your Actor's **Source** page in Apify Console @@ -140,25 +147,22 @@ Once you start a build, you cannot change its environment variables. To use diff Learn more in [Builds](../builds_and_runs/builds.md). ::: -## Access environment variables +### Use the `Configuration` class -You can access environment variables in your code as follows: +For more convenient access to Actor configuration, use the [`Configuration`](/sdk/js/reference/class/Configuration) class -In Node.js, use the `process.env` object: - ```js import { Actor } from 'apify'; await Actor.init(); -// get MYSQL_USER -const mysql_user = process.env.MYSQL_USER - -// print MYSQL_USER to console -console.log(mysql_user); +// get current token +const token = Actor.config.get('token'); +// use different token +Actor.config.set('token', 's0m3n3wt0k3n'); await Actor.exit(); ``` @@ -166,42 +170,43 @@ await Actor.exit(); -In Python, use the `os.environ` dictionary: - ```python -import os -print(os.environ['MYSQL_USER']) - from apify import Actor async def main(): async with Actor: - # get MYSQL_USER - mysql_user = os.environ['MYSQL_USER'] + old_token = Actor.configuration.token + Actor.log.info(f'old_token = {old_token}') - # print MYSQL_USER to console - print(mysql_user) + # use different token + Actor.configuration.token = 's0m3n3wt0k3n' + + new_token = Actor.configuration.token + Actor.log.info(f'new_token = {new_token}') ``` -## Use the `Configuration` class +## Access environment variables -For more convenient access to Actor configuration, use the [`Configuration`](/sdk/js/reference/class/Configuration) class +You can access environment variables in your code as follows: +In Node.js, use the `process.env` object: + ```js import { Actor } from 'apify'; await Actor.init(); -// get current token -const token = Actor.config.get('token'); -// use different token -Actor.config.set('token', 's0m3n3wt0k3n'); +// get MYSQL_USER +const mysql_user = process.env.MYSQL_USER + +// print MYSQL_USER to console +console.log(mysql_user); await Actor.exit(); ``` @@ -209,19 +214,21 @@ await Actor.exit(); +In Python, use the `os.environ` dictionary: + ```python +import os +print(os.environ['MYSQL_USER']) + from apify import Actor async def main(): async with Actor: - old_token = Actor.configuration.token - Actor.log.info(f'old_token = {old_token}') - - # use different token - Actor.configuration.token = 's0m3n3wt0k3n' + # get MYSQL_USER + mysql_user = os.environ['MYSQL_USER'] - new_token = Actor.configuration.token - Actor.log.info(f'new_token = {new_token}') + # print MYSQL_USER to console + print(mysql_user) ``` From eeb822490694d9d852923762018c19ff848c00ef Mon Sep 17 00:00:00 2001 From: Jan Curn Date: Wed, 20 May 2026 12:49:00 +0200 Subject: [PATCH 03/14] Better copy --- .../environment_variables.md | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index 41319b7d33..c48450358f 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -6,16 +6,14 @@ sidebar_position: 3 sidebar_label: Environment variables --- -**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 using environment variables, either set by the Apify platform or custom.** import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; --- -## How to use environment variables in an Actor - -Environment variables come from two sources: +Actor runs get their environment variables from two sources: - [System environment variables](#system-environment-variables) - set automatically by the Apify platform for each Actor run. - [Custom environment variables](#custom-environment-variables) - defined by the Actor owner, either in `.actor/actor.json` or in Apify Console. @@ -147,22 +145,25 @@ Once you start a build, you cannot change its environment variables. To use diff Learn more in [Builds](../builds_and_runs/builds.md). ::: -### Use the `Configuration` class +## Access environment variables -For more convenient access to Actor configuration, use the [`Configuration`](/sdk/js/reference/class/Configuration) class +You can access environment variables in your code as follows: +In Node.js, use the `process.env` object: + ```js import { Actor } from 'apify'; await Actor.init(); -// get current token -const token = Actor.config.get('token'); -// use different token -Actor.config.set('token', 's0m3n3wt0k3n'); +// get MYSQL_USER +const mysql_user = process.env.MYSQL_USER + +// print MYSQL_USER to console +console.log(mysql_user); await Actor.exit(); ``` @@ -170,43 +171,43 @@ await Actor.exit(); +In Python, use the `os.environ` dictionary: + ```python +import os +print(os.environ['MYSQL_USER']) + from apify import Actor async def main(): async with Actor: - old_token = Actor.configuration.token - Actor.log.info(f'old_token = {old_token}') - - # use different token - Actor.configuration.token = 's0m3n3wt0k3n' + # get MYSQL_USER + mysql_user = os.environ['MYSQL_USER'] - new_token = Actor.configuration.token - Actor.log.info(f'new_token = {new_token}') + # print MYSQL_USER to console + print(mysql_user) ``` -## Access environment variables -You can access environment variables in your code as follows: +### Use the `Configuration` class + +For more convenient access to Actor configuration, use the [`Configuration`](/sdk/js/reference/class/Configuration) class -In Node.js, use the `process.env` object: - ```js import { Actor } from 'apify'; await Actor.init(); -// get MYSQL_USER -const mysql_user = process.env.MYSQL_USER - -// print MYSQL_USER to console -console.log(mysql_user); +// get current token +const token = Actor.config.get('token'); +// use different token +Actor.config.set('token', 's0m3n3wt0k3n'); await Actor.exit(); ``` @@ -214,26 +215,25 @@ await Actor.exit(); -In Python, use the `os.environ` dictionary: - ```python -import os -print(os.environ['MYSQL_USER']) - from apify import Actor async def main(): async with Actor: - # get MYSQL_USER - mysql_user = os.environ['MYSQL_USER'] + old_token = Actor.configuration.token + Actor.log.info(f'old_token = {old_token}') - # print MYSQL_USER to console - print(mysql_user) + # use different token + Actor.configuration.token = 's0m3n3wt0k3n' + + new_token = Actor.configuration.token + Actor.log.info(f'new_token = {new_token}') ``` + ## Build-time environment variables 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: From c964dffe1865e3ffd16db1a47fb5f70453b42ef4 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 20 May 2026 10:56:40 +0000 Subject: [PATCH 04/14] docs: tighten env var copy and split out secure variables section - 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 --- .../environment_variables.md | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index c48450358f..a705b81de9 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -6,7 +6,7 @@ sidebar_position: 3 sidebar_label: Environment variables --- -**Learn how your Actors get runtime context using environment variables, either set by the Apify platform or custom.** +**Learn how your Actors get runtime context from environment variables - either set by the Apify platform or defined by you.** import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -28,7 +28,7 @@ Apify sets several system environment variables for each Actor run. These variab :::info Run-time only -System environment variables are set only when the Actor runs. They are not available during the build process, even if you enable **Apply environment variables also to the build process** in the Actor's **Code** > **Environment variables** section. That option only forwards user-defined environment variables to the build; system variables such as `ACTOR_RUN_ID`, `APIFY_TOKEN`, or `ACTOR_DEFAULT_DATASET_ID` are never passed to builds. +System variables apply only to Actor runs and are never passed to builds - not even when **Apply environment variables also to the build process** is enabled in **Code** > **Environment variables**. That option forwards only your custom variables. ::: @@ -87,8 +87,8 @@ All date-related variables use the UTC timezone and are in [ISO 8601](https://en Actor owners can define custom environment variables to pass additional configuration to their Actors. There are two ways to set them up: -- [Set up environment variables in `actor.json`](#set-up-environment-variables-in-actorjson) -- [Set up environment variables in Apify Console](#set-up-environment-variables-in-apify-console) +- [Define in `actor.json`](#define-in-actorjson) +- [Define in Apify Console](#define-in-apify-console) :::info Environment variable precedence @@ -96,7 +96,7 @@ Your local `.actor/actor.json` file overrides variables set in Apify Console. To ::: -### Set up environment variables in `actor.json` +### Define in `actor.json` Actor owners can define custom environment variables in `.actor/actor.json`. All keys from `environmentVariables` will be set as environment variables into the Apify platform after you push Actor to Apify. @@ -118,31 +118,33 @@ Be aware that if you define `environmentVariables` in `.actor/actor.json`, it on ::: -### Set up environment variables in Apify Console +### Define in Apify Console To set custom variables in Apify Console: -1. Go to your Actor's **Source** page in Apify Console +1. Go to your Actor's **Source** page in Apify Console. 1. Navigate to the **Environment variables** section. 1. Add your custom variables. -For sensitive data like API keys or passwords, enable the **Secret** option. This will encrypt the value and redact it from logs to prevent accidental exposure. +:::info Build-time variables -:::caution Visibility of environment variables in public Actors +Once you start a build, you cannot change its environment variables. To use different variables, you must create a new build. -When you [publish your Actor](/platform/actors/publishing/publish), environment variables not marked as **Secret** in Apify Console are visible to anyone on the Actor detail page alongside the source code. Enable **Hide source files from Actor detail** in the Actor's **Settings** to hide both. +Learn more in [Builds](../builds_and_runs/builds.md). +::: -Secret environment variables are never exposed on the Actor detail page regardless of this setting. Always mark sensitive values as **Secret**. +### Secure environment variables -::: +For sensitive data such as API keys or passwords, enable the **Secret** option when defining a variable in Apify Console. Secret values are encrypted at rest and redacted from logs to prevent accidental exposure. -:::info Build-time variables +:::caution Visibility of environment variables in public Actors -Once you start a build, you cannot change its environment variables. To use different variables, you must create a new build. +When you [publish your Actor](/platform/actors/publishing/publish), environment variables not marked as **Secret** are visible to anyone on the Actor detail page alongside the source code. Enable **Hide source files from Actor detail** in the Actor's **Settings** to hide both. + +Secret environment variables are never exposed on the Actor detail page regardless of this setting. Always mark sensitive values as **Secret**. -Learn more in [Builds](../builds_and_runs/builds.md). ::: ## Access environment variables From f31391497ed227ba1739abc56650456f2005c4f0 Mon Sep 17 00:00:00 2001 From: Jan Curn Date: Wed, 20 May 2026 14:26:29 +0200 Subject: [PATCH 05/14] Better copy --- .../development/programming_interface/environment_variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index a705b81de9..283f279b29 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -137,7 +137,7 @@ Learn more in [Builds](../builds_and_runs/builds.md). ### Secure environment variables -For sensitive data such as API keys or passwords, enable the **Secret** option when defining a variable in Apify Console. Secret values are encrypted at rest and redacted from logs to prevent accidental exposure. +For sensitive data such as API keys or passwords, enable the **Secret** option when defining a variable in Apify Console. Secret values are encrypted at rest and redacted from Actor run logs to prevent accidental exposure. :::caution Visibility of environment variables in public Actors From c21345e1740708976e8f4ec27a27be7a1a51f9a9 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 20 May 2026 12:40:05 +0000 Subject: [PATCH 06/14] docs: link actor.json to its reference page --- .../development/programming_interface/environment_variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index 283f279b29..7357b1864e 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -98,7 +98,7 @@ Your local `.actor/actor.json` file overrides variables set in Apify Console. To ### Define in `actor.json` -Actor owners can define custom environment variables in `.actor/actor.json`. All keys from `environmentVariables` will be set as environment variables into the Apify platform after you push Actor to Apify. +Actor owners can define custom environment variables in [`.actor/actor.json`](/platform/actors/development/actor-definition/actor-json). All keys from `environmentVariables` will be set as environment variables into the Apify platform after you push Actor to Apify. ```json { From 01112560a8e9d0558c611376a6a4d1de258fa468 Mon Sep 17 00:00:00 2001 From: Jan Curn Date: Wed, 20 May 2026 14:52:56 +0200 Subject: [PATCH 07/14] Better copy --- .../environment_variables.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index 7357b1864e..c9ce6c4e73 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -90,12 +90,18 @@ Actor owners can define custom environment variables to pass additional configur - [Define in `actor.json`](#define-in-actorjson) - [Define in Apify Console](#define-in-apify-console) -:::info Environment variable precedence +Your local `.actor/actor.json` file overrides variables set in Apify Console. +To use Console variables, remove the `environmentVariables` key from the local file. -Your local `.actor/actor.json` file overrides variables set in Apify Console. To use Console variables, remove the `environmentVariables` key from the local file. +:::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). ::: + ### Define in `actor.json` Actor owners can define custom environment variables in [`.actor/actor.json`](/platform/actors/development/actor-definition/actor-json). All keys from `environmentVariables` will be set as environment variables into the Apify platform after you push Actor to Apify. @@ -128,13 +134,6 @@ To set custom variables in Apify Console: 1. Add your custom variables. -:::info Build-time variables - -Once you start a build, you cannot change its environment variables. To use different variables, you must create a new build. - -Learn more in [Builds](../builds_and_runs/builds.md). -::: - ### Secure environment variables For sensitive data such as API keys or passwords, enable the **Secret** option when defining a variable in Apify Console. Secret values are encrypted at rest and redacted from Actor run logs to prevent accidental exposure. From 8e964180edee6e18ccc766fc61127bede946ed61 Mon Sep 17 00:00:00 2001 From: Jan Curn Date: Wed, 20 May 2026 14:53:52 +0200 Subject: [PATCH 08/14] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../development/programming_interface/environment_variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index c9ce6c4e73..933ea7c671 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -195,7 +195,7 @@ async def main(): ### Use the `Configuration` class -For more convenient access to Actor configuration, use the [`Configuration`](/sdk/js/reference/class/Configuration) class +For more convenient access to Actor configuration, use the [`Configuration`](/sdk/js/reference/class/Configuration) class. From a66cb32cfb5d7bfd53356efdf15c2ef0210bee17 Mon Sep 17 00:00:00 2001 From: Jan Curn Date: Thu, 21 May 2026 16:07:16 +0200 Subject: [PATCH 09/14] Update sources/platform/actors/development/programming_interface/environment_variables.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michał Olender <92638966+TC-MO@users.noreply.github.com> --- .../development/programming_interface/environment_variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index 933ea7c671..b109f92756 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -1,6 +1,6 @@ --- title: Actor environment variables -description: Learn how to provide your Actor with context that determines its behavior through a plethora of pre-defined environment variables offered by the Apify SDK. +description: Learn how Actors receive runtime context from system environment variables set by the Apify platform and custom variables you define. slug: /actors/development/programming-interface/environment-variables sidebar_position: 3 sidebar_label: Environment variables From 2a4d900cdb504f000ba8bf6e2f16a64e743b85b2 Mon Sep 17 00:00:00 2001 From: Jan Curn Date: Thu, 21 May 2026 16:07:54 +0200 Subject: [PATCH 10/14] Update sources/platform/actors/development/programming_interface/environment_variables.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michał Olender <92638966+TC-MO@users.noreply.github.com> --- .../development/programming_interface/environment_variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index b109f92756..f26fcab0a5 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -120,7 +120,7 @@ Actor owners can define custom environment variables in [`.actor/actor.json`](/p :::info Git-workflow with actor.json -Be aware that if you define `environmentVariables` in `.actor/actor.json`, it only works with [Apify CLI](/cli). If you use a Git workflow for Actor development, the environment variables will not be set from `.actor/actor.json` and you need to define them in Apify Console. +If you define `environmentVariables` in `.actor/actor.json`, it only works with [Apify CLI](/cli). If you use a Git workflow for Actor development, the environment variables will not be set from `.actor/actor.json` and you need to define them in Apify Console. ::: From 875878c137f46d7b0ef1176bf9bbd6e717818cea Mon Sep 17 00:00:00 2001 From: Jan Curn Date: Thu, 21 May 2026 16:08:13 +0200 Subject: [PATCH 11/14] Update sources/platform/actors/development/programming_interface/environment_variables.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michał Olender <92638966+TC-MO@users.noreply.github.com> --- .../development/programming_interface/environment_variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index f26fcab0a5..f16fa72790 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -26,7 +26,7 @@ Check out how you can [access environment variables in Actors](#access-environme Apify sets several system environment variables for each Actor run. These variables provide essential context and information about the Actor's execution environment. -:::info Run-time only +:::info Runtime only System variables apply only to Actor runs and are never passed to builds - not even when **Apply environment variables also to the build process** is enabled in **Code** > **Environment variables**. That option forwards only your custom variables. From f51e2c93bbf2818a045edb9449c7d88ca2aef7cf Mon Sep 17 00:00:00 2001 From: Jan Curn Date: Thu, 21 May 2026 16:08:30 +0200 Subject: [PATCH 12/14] Update sources/platform/actors/development/programming_interface/environment_variables.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michał Olender <92638966+TC-MO@users.noreply.github.com> --- .../development/programming_interface/environment_variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index f16fa72790..271d715029 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -113,7 +113,7 @@ Actor owners can define custom environment variables in [`.actor/actor.json`](/p "version": "0.1", "buildTag": "latest", "environmentVariables": { - "MYSQL_USER": "my_username", + "MYSQL_USER": "my_username" } } ``` From 9b6e802cbe5deafc070f5bf4d98920482e1c09d1 Mon Sep 17 00:00:00 2001 From: Jan Curn Date: Thu, 21 May 2026 16:08:47 +0200 Subject: [PATCH 13/14] Update sources/platform/actors/development/programming_interface/environment_variables.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michał Olender <92638966+TC-MO@users.noreply.github.com> --- .../development/programming_interface/environment_variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index 271d715029..57534af9e2 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -85,7 +85,7 @@ All date-related variables use the UTC timezone and are in [ISO 8601](https://en ## Custom environment variables -Actor owners can define custom environment variables to pass additional configuration to their Actors. There are two ways to set them up: +Actor owners can define custom environment variables to pass additional configuration to their Actors. - [Define in `actor.json`](#define-in-actorjson) - [Define in Apify Console](#define-in-apify-console) From 1326bd49f6ac6a97346a58e977858763000d52c6 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 21 May 2026 14:11:31 +0000 Subject: [PATCH 14/14] docs: apply TC-MO cleanup suggestions - 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 --- .../environment_variables.md | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index 57534af9e2..ff193b16f2 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -6,13 +6,9 @@ sidebar_position: 3 sidebar_label: Environment variables --- -**Learn how your Actors get runtime context from environment variables - either set by the Apify platform or defined by you.** - import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; ---- - Actor runs get their environment variables from two sources: - [System environment variables](#system-environment-variables) - set automatically by the Apify platform for each Actor run. @@ -32,8 +28,6 @@ System variables apply only to Actor runs and are never passed to builds - not e ::: -Here's a table of key system environment variables: - | Environment variable | Description | | -------------------- | ----------- | | `ACTOR_ID` | ID of the Actor. | @@ -93,15 +87,6 @@ Actor owners can define custom environment variables to pass additional configur Your local `.actor/actor.json` file overrides variables set in Apify Console. To use Console variables, remove the `environmentVariables` key from the local file. -:::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). -::: - - ### Define in `actor.json` Actor owners can define custom environment variables in [`.actor/actor.json`](/platform/actors/development/actor-definition/actor-json). All keys from `environmentVariables` will be set as environment variables into the Apify platform after you push Actor to Apify. @@ -259,5 +244,3 @@ Build-time environment variables are not suitable for secrets, as they are not e ::: 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.