# Code Navigation Environment Variables

<p className="subtitle">
	These docs list supported environment variables for Code Navigation.
</p>

## frontend

The following are variables are read from the `frontend` service to control code navigation behavior exposed via the GraphQL API.

The following settings should be the same for the [`precise-code-intel-worker`](#precise-code-intel-worker) service as well.

| **Name**                                  | **Default**    | **Description**                                                                                                                                                        |
| ----------------------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `PRECISE_CODE_INTEL_UPLOAD_BACKEND`       | `blobstore`    | The target file service for code graph uploads. S3, GCS, and Blobstore are supported. In older versions of Sourcegraph (before v3.4.2) `Minio` was also a valid value. |
| `PRECISE_CODE_INTEL_UPLOAD_MANAGE_BUCKET` | `false`        | Whether or not the client should manage the target bucket configuration                                                                                                |
| `PRECISE_CODE_INTEL_UPLOAD_BUCKET`        | `lsif-uploads` | The name of the bucket to store LSIF uploads in                                                                                                                        |
| `PRECISE_CODE_INTEL_UPLOAD_TTL`           | `168h`         | The maximum age of an upload before deletion                                                                                                                           |

The following settings should be the same for the [`codeintel-auto-indexing`](#codeintel-auto-indexing) worker task as well.

| **Name**                                                                      | **Default** | **Description**                                                                                                  |
| ----------------------------------------------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------- |
| `PRECISE_CODE_INTEL_AUTO_INDEX_MAXIMUM_REPOSITORIES_INSPECTED_PER_SECOND`     | `0`         | The maximum number of repositories inspected for auto-indexing per second. Set to zero to disable limit.         |
| `PRECISE_CODE_INTEL_AUTO_INDEX_MAXIMUM_REPOSITORIES_UPDATED_PER_SECOND`       | `0`         | The maximum number of repositories cloned or fetched for auto-indexing per second. Set to zero to disable limit. |
| `PRECISE_CODE_INTEL_AUTO_INDEX_MAXIMUM_INDEX_JOBS_PER_INFERRED_CONFIGURATION` | `25`        | Repositories with a number of inferred auto-index jobs exceeding this threshold will be auto-indexed             |

## worker

The following are variables are read from the `worker` service to control code graph data behavior run in asynchronous background tasks.

### `codeintel-commitgraph`

The following variables influence the behavior of the [`codeintel-commitgraph` worker task](/self-hosted/workers#codeintel-commitgraph).

| **Name**                                               | **Default**              | **Description**                                                                                                               |
| ------------------------------------------------------ | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
| `PRECISE_CODE_INTEL_MAX_AGE_FOR_NON_STALE_BRANCHES`    | `2160h` (about 3 months) | The age after which a branch should be considered stale. Code graph indexes will be evicted from stale branches.              |
| `PRECISE_CODE_INTEL_MAX_AGE_FOR_NON_STALE_TAGS`        | `8760h` (about 1 year)   | The age after which a tagged commit should be considered stale. Code graph indexes will be evicted from stale tagged commits. |
| `PRECISE_CODE_INTEL_COMMIT_GRAPH_UPDATE_TASK_INTERVAL` | `10s`                    | The frequency with which to run periodic codeintel commit graph update tasks.                                                 |

### `codeintel-auto-indexing`

The following variables influence the behavior of the [`codeintel-auto-indexing` worker task](/self-hosted/workers#codeintel-auto-indexing).

| **Name**                                                        | **Default** | **Description**                                                                             |
| --------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------- |
| `PRECISE_CODE_INTEL_AUTO_INDEXING_TASK_INTERVAL`                | `10m`       | The frequency with which to run periodic codeintel auto-indexing tasks.                     |
| `PRECISE_CODE_INTEL_AUTO_INDEXING_REPOSITORY_PROCESS_DELAY`     | `24h`       | The minimum frequency that the same repository can be considered for auto-index scheduling. |
| `PRECISE_CODE_INTEL_AUTO_INDEXING_REPOSITORY_BATCH_SIZE`        | `100`       | The number of repositories to consider for auto-indexing scheduling at a time.              |
| `PRECISE_CODE_INTEL_AUTO_INDEXING_POLICY_BATCH_SIZE`            | `100`       | The number of policies to consider for auto-indexing scheduling at a time.                  |
| `PRECISE_CODE_INTEL_DEPENDENCY_INDEXER_SCHEDULER_POLL_INTERVAL` | `1s`        | Interval between queries to the dependency indexing job queue.                              |
| `PRECISE_CODE_INTEL_DEPENDENCY_INDEXER_SCHEDULER_CONCURRENCY`   | `1`         | The maximum number of dependency graphs that can be processed concurrently.                 |

The following settings should be the same for the [`frontend`](#frontend) service as well.

| **Name**                                                                      | **Default** | **Description**                                                                                      |
| ----------------------------------------------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------- |
| `PRECISE_CODE_INTEL_AUTO_INDEX_MAXIMUM_INDEX_JOBS_PER_INFERRED_CONFIGURATION` | `25`        | Repositories with a number of inferred auto-index jobs exceeding this threshold will be auto-indexed |

### `codeintel-janitor`

The following variables influence the behavior of the [`codeintel-janitor` worker task](/self-hosted/workers#codeintel-janitor).

| **Name**                                                           | **Default** | **Description**                                                                                                                                                                                                                      |     |
| ------------------------------------------------------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --- |
| `PRECISE_CODE_INTEL_UPLOAD_TIMEOUT`                                | `24h`       | The maximum time an upload can be in the 'uploading' state.                                                                                                                                                                          |
| `PRECISE_CODE_INTEL_COMMIT_RESOLVER_MINIMUM_TIME_SINCE_LAST_CHECK` | `24h`       | The minimum time the commit resolver will re-check an upload or index record.                                                                                                                                                        |
| `PRECISE_CODE_INTEL_COMMIT_RESOLVER_BATCH_SIZE`                    | `100`       | The maximum number of unique commits to resolve at a time.                                                                                                                                                                           |
| `PRECISE_CODE_INTEL_COMMIT_RESOLVER_MAXIMUM_COMMIT_LAG`            | `0s`        | The maximum acceptable delay between accepting an upload and its commit becoming resolvable. Be cautious about setting this to a large value, as uploads for unresolvable commits will be retried periodically during this interval. |
| `PRECISE_CODE_INTEL_RETENTION_REPOSITORY_PROCESS_DELAY`            | `24h`       | The minimum frequency that the same repository's uploads can be considered for expiration.                                                                                                                                           |
| `PRECISE_CODE_INTEL_RETENTION_REPOSITORY_BATCH_SIZE`               | `100`       | The number of repositories to consider for expiration at a time.                                                                                                                                                                     |
| `PRECISE_CODE_INTEL_RETENTION_UPLOAD_PROCESS_DELAY`                | `24h`       | The minimum frequency that the same upload record can be considered for expiration.                                                                                                                                                  |
| `PRECISE_CODE_INTEL_RETENTION_UPLOAD_BATCH_SIZE`                   | `100`       | The number of uploads to consider for expiration at a time.                                                                                                                                                                          |
| `PRECISE_CODE_INTEL_RETENTION_POLICY_BATCH_SIZE`                   | `100`       | The number of policies to consider for expiration at a time.                                                                                                                                                                         |
| `PRECISE_CODE_INTEL_RETENTION_COMMIT_BATCH_SIZE`                   | `100`       | The number of commits to process per upload at a time.                                                                                                                                                                               |
| `PRECISE_CODE_INTEL_CONFIGURATION_POLICY_MEMBERSHIP_BATCH_SIZE`    | `100`       | The maximum number of policy configurations to update repository membership for at a time.                                                                                                                                           |

## precise-code-intel-worker

The following are variables are read from the `precise-code-intel-worker` service to control code graph data upload processing behavior.

| **Name**                                  | **Default** | **Description**                                                   |
| ----------------------------------------- | ----------- | ----------------------------------------------------------------- |
| `PRECISE_CODE_INTEL_WORKER_POLL_INTERVAL` | `1s`        | Interval between queries to the upload queue.                     |
| `PRECISE_CODE_INTEL_WORKER_CONCURRENCY`   | `1`         | The maximum number of indexes that can be processed concurrently. |

The following settings should be the same for the [`frontend`](#frontend) service as well.

| **Name**                                  | **Default**    | **Description**                                                                            |
| ----------------------------------------- | -------------- | ------------------------------------------------------------------------------------------ |
| `PRECISE_CODE_INTEL_UPLOAD_BACKEND`       | `blobstore`    | The target file service for code graph data uploads. S3, GCS, and Blobstore are supported. |
| `PRECISE_CODE_INTEL_UPLOAD_MANAGE_BUCKET` | `false`        | Whether or not the client should manage the target bucket configuration                    |
| `PRECISE_CODE_INTEL_UPLOAD_BUCKET`        | `lsif-uploads` | The name of the bucket to store LSIF uploads in                                            |
| `PRECISE_CODE_INTEL_UPLOAD_TTL`           | `168h`         | The maximum age of an upload before deletion                                               |
