Back to Turborepo

System environment variables

apps/docs/content/docs/reference/system-environment-variables.mdx

2.9.1512.3 KB
Original Source

By setting certain environment variables, you can change Turborepo's behavior. This can be useful for creating specific configurations for different environments and machines.

System environment variables are always overridden by flag values provided directly to your turbo commands.

<table id="system-environment-variables-table"> <thead> <tr> <th>Variable</th> <th>Description</th> </tr> </thead> <tbody> <tr id="force_color"> <td> <code>FORCE_COLOR</code> </td> <td>Forces color to be shown in terminal logs</td> </tr> <tr id="turbo_api"> <td> <code>TURBO_API</code> </td> <td> Set the base URL for{" "} <a href="/docs/core-concepts/remote-caching">Remote Cache</a>. </td> </tr> <tr id="turbo_binary_path"> <td> <code>TURBO_BINARY_PATH</code> </td> <td> Manually set the path to the <code>turbo</code> binary. By default,{" "} <code>turbo</code> will automatically discover the binary so you should only use this in rare circumstances. </td> </tr> <tr id="turbo_cache"> <td> <code>TURBO_CACHE</code> </td> <td> Control reading and writing for cache sources. Uses the same syntax as <code>[--cache](/docs/reference/run#--cache-options)</code>. </td> </tr> <tr id="turbo_cache_dir"> <td> <code>TURBO_CACHE_DIR</code> </td> <td> <span>Sets the cache directory, similar to using</span>{" "} <code>[--cache-dir](/docs/reference/run#--cache-dir-path)</code> <span> flag.</span> </td> </tr> <tr id="turbo_cache_max_age"> <td> <code>TURBO_CACHE_MAX_AGE</code> </td> <td> Maximum age of local cache entries before automatic eviction. Accepts a human-readable duration string (e.g. <code>7d</code>,{" "} <code>24h</code>, <code>2w</code>). See{" "} <a href="/docs/reference/configuration#cachemaxage"><code>cacheMaxAge</code></a>. </td> </tr> <tr id="turbo_cache_max_size"> <td> <code>TURBO_CACHE_MAX_SIZE</code> </td> <td> Maximum total size of the local filesystem cache. When exceeded, the oldest entries are evicted. Accepts a human-readable size string (e.g.{" "} <code>10GB</code>, <code>500MB</code>). See{" "} <a href="/docs/reference/configuration#cachemaxsize"><code>cacheMaxSize</code></a>. </td> </tr> <tr id="turbo_ci_vendor_env_key"> <td> <code>TURBO_CI_VENDOR_ENV_KEY</code> </td> <td> <span>Set a prefix for environment variables that you want</span> <strong> excluded</strong> <span>from</span> [Framework Inference](/docs/crafting-your-repository/using-environment-variables#framework-inference).{" "} <div></div> <strong>NOTE</strong>: This does not need to be set by the user and should be configured automatically by supported platforms. </td> </tr> <tr id="turbo_dangerously_disable_package_manager_check"> <td> <code>TURBO_DANGEROUSLY_DISABLE_PACKAGE_MANAGER_CHECK</code> </td> <td> Disable checking the <code>packageManager</code> field in <code>package.json</code>. <div></div> You may run into [errors and unexpected caching behavior](/docs/reference/run#--dangerously-disable-package-manager-check) when disabling this check. Use <code>true</code> or <code>1</code> to disable. </td> </tr> <tr id="turbo_download_local_enabled"> <td> <code>TURBO_DOWNLOAD_LOCAL_ENABLED</code> </td> <td> Enables global <code>turbo</code> to install the correct local version if one is not found. </td> </tr> <tr id="turbo_force"> <td> <code>TURBO_FORCE</code> </td> <td> Set to <code>true</code> to force all tasks to run in full, opting out of all caching. </td> </tr> <tr id="turbo_global_warning_disabled"> <td> <code>TURBO_GLOBAL_WARNING_DISABLED</code> </td> <td> Disable warning when global <code>turbo</code> cannot find a local version to use. </td> </tr> <tr id="turbo_print_version_disabled"> <td> <code>TURBO_PRINT_VERSION_DISABLED</code> </td> <td> Disable printing the version of <code>turbo</code> that is being executed. </td> </tr> <tr id="turbo_log_file"> <td> <code>TURBO_LOG_FILE</code> </td> <td> Write structured JSON logs to a file. Set to <code>1</code> or{" "} <code>true</code> for the default location ( <code>.turbo/logs/&lt;timestamp&gt;.json</code>), or provide a custom file path. Equivalent to the{" "} <a href="/docs/reference/run#--log-file-path">--log-file</a> flag. </td> </tr> <tr id="turbo_log_order"> <td> <code>TURBO_LOG_ORDER</code> </td> <td> <span>Set the</span>{" "} <a href="/docs/reference/run#--log-order-option">log order</a> <span>. Allowed values are</span> <code>grouped</code> <span>and</span>{" "} <code>default</code> <span>.</span> </td> </tr> <tr id="turbo_login"> <td> <code>TURBO_LOGIN</code> </td> <td> Set the URL used to log in to [Remote Cache](/docs/core-concepts/remote-caching). <div></div> Only needed for self-hosted Remote Caches that implement an endpoint that dynamically creates tokens. </td> </tr> <tr id="turbo_no_update_notifier"> <td> <code>TURBO_NO_UPDATE_NOTIFIER</code> </td> <td> Remove the update notifier that appears when a new version of <code>turbo</code>is available. <div></div> You can also use <code>NO_UPDATE_NOTIFIER</code> per ecosystem convention. </td> </tr> <tr id="turbo_platform_env"> <td> <code>TURBO_PLATFORM_ENV</code> </td> <td> A CSV of environment variable keys that are configured in a supported CI environment (Vercel). <div></div> <strong>NOTE</strong>: This variable is meant for platforms looking to implement zero-configuration environment variables. You are not meant to use this variable as an end user. </td> </tr> <tr id="turbo_platform_env_disabled"> <td> <code>TURBO_PLATFORM_ENV_DISABLED</code> </td> <td> <span>Disable checking environment variables configured in your</span>{" "} <code>turbo.json</code>{" "} <span>against those set on your supported platform</span> </td> </tr> <tr id="turbo_preflight"> <td> <code>TURBO_PREFLIGHT</code> </td> <td> Enables sending a preflight request before every cache artifact and analytics request. The follow-up upload and download will follow redirects. Only applicable when{" "} <a href="/docs/core-concepts/remote-caching">Remote Caching</a> is configured. </td> </tr> <tr id="turbo_remote_cache_read_only"> <td> <code>TURBO_REMOTE_CACHE_READ_ONLY</code> </td> <td> Prevent writing to the{" "} <a href="/docs/core-concepts/remote-caching">Remote Cache</a> - but still allow reading. </td> </tr> <tr id="turbo_remote_cache_signature_key"> <td> <code>TURBO_REMOTE_CACHE_SIGNATURE_KEY</code> </td> <td> Sign artifacts with a secret key. Must be at least 32 bytes when [`futureFlags.longerSignatureKey`](/docs/reference/configuration#longersignaturekey) is enabled. For more information, visit [the Artifact Integrity section](/docs/core-concepts/remote-caching#artifact-integrity-and-authenticity-verification). </td> </tr> <tr id="turbo_remote_cache_timeout"> <td> <code>TURBO_REMOTE_CACHE_TIMEOUT</code> </td> <td> Set a timeout in seconds for <code>turbo</code> to get artifacts from{" "} <a href="/docs/core-concepts/remote-caching">Remote Cache</a>. </td> </tr> <tr id="turbo_remote_cache_upload_timeout"> <td> <code>TURBO_REMOTE_CACHE_UPLOAD_TIMEOUT</code> </td> <td> Set a timeout in seconds for <code>turbo</code> to upload artifacts to{" "} <a href="/docs/core-concepts/remote-caching">Remote Cache</a>. </td> </tr> <tr id="turbo_remote_only"> <td> <code>TURBO_REMOTE_ONLY</code> </td> <td>Always ignore the local filesystem cache for all tasks.</td> </tr> <tr id="turbo_run_summary"> <td> <code>TURBO_RUN_SUMMARY</code> </td> <td> Generate a <a href="/docs/reference/run#--summarize">Run Summary</a>{" "} when you run tasks. </td> </tr> <tr id="turbo_scm_base"> <td> <code>TURBO_SCM_BASE</code> </td> <td> Base used by <code>--affected</code> and{" "} <code>turbo query affected</code> when calculating what has changed from{" "} <code>base...head</code> </td> </tr> <tr id="turbo_scm_head"> <td> <code>TURBO_SCM_HEAD</code> </td> <td> Head used by <code>--affected</code> and{" "} <code>turbo query affected</code> when calculating what has changed from{" "} <code>base...head</code> </td> </tr> <tr id="turbo_team"> <td> <code>TURBO_TEAM</code> </td> <td> The account name associated with your repository. When using{" "} [Vercel Remote Cache](https://vercel.com/docs/monorepos/remote-caching#vercel-remote-cache), this is [your team's slug](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fsettings&title=Get+team+slug). </td> </tr> <tr id="turbo_teamid"> <td> <code>TURBO_TEAMID</code> </td> <td> The account identifier associated with your repository. When using [Vercel Remote Cache](https://vercel.com/docs/monorepos/remote-caching#vercel-remote-cache), this is your team's ID. </td> </tr> <tr id="turbo_telemetry_message_disabled"> <td> <code>TURBO_TELEMETRY_MESSAGE_DISABLED</code> </td> <td> Disable the message notifying you that{" "} <a href="/docs/telemetry">Telemetry</a> is enabled. </td> </tr> <tr id="turbo_token"> <td> <code>TURBO_TOKEN</code> </td> <td> The Bearer token for authentication to access{" "} <a href="/docs/core-concepts/remote-caching">Remote Cache</a>. </td> </tr> <tr id="turbo_ui"> <td> <code>TURBO_UI</code> </td> <td> Enables TUI when passed true or 1, disables when passed false or 0. </td> </tr> <tr id="turbo_concurrency"> <td> <code>TURBO_CONCURRENCY</code> </td> <td> Controls [concurrency](/repo/docs/reference/run#--concurrency-number--percentage) settings in run or watch mode. </td> </tr> <tr id="turbo_sso_login_callback_port"> <td> <code>TURBO_SSO_LOGIN_CALLBACK_PORT</code> </td> <td> Override the default port (9789) used for the SSO login callback server during authentication. </td> </tr> </tbody> </table>

Environment variables in tasks

Turborepo will make the following environment variables available within your tasks while they are executing:

VariableDescription
TURBO_HASHThe hash of the currently running task.
TURBO_IS_TUIWhen using the TUI, this variable is set to true.
TURBO_IS_MFEWhen using the microfrontends, this variable is set to the port defined in microfrontends.json for the application.