|
| 1 | +--- |
| 2 | +title: Config File |
| 3 | +sidebarTitle: Config file |
| 4 | +--- |
| 5 | + |
| 6 | +When self-hosting Sourcebot, you **must** provide it a config file. This is done by defining a config file in a volume that's mounted to Sourcebot, and providing the path to this |
| 7 | +file in the `CONFIG_PATH` environment variable. For example: |
| 8 | + |
| 9 | +```bash icon="terminal" Passing in a CONFIG_PATH to Sourcebot |
| 10 | +docker run \ |
| 11 | + -v $(pwd)/config.json:/data/config.json \ |
| 12 | + -e CONFIG_PATH=/data/config.json \ |
| 13 | + ... \ # other options |
| 14 | + ghcr.io/sourcebot-dev/sourcebot:latest |
| 15 | +``` |
| 16 | + |
| 17 | +The config file tells Sourcebot which repos to index, what language models to use, and various other settings as defined in the [schema](#config-file-schema). |
| 18 | + |
| 19 | +# Config File Schema |
| 20 | + |
| 21 | +The config file you provide Sourcebot must follow the [schema](https://github.com/sourcebot-dev/sourcebot/blob/main/schemas/v3/index.json). This schema consists of the following properties: |
| 22 | + |
| 23 | +- [Connections](/docs/connections/overview) (`connections`): Defines a set of connections that tell Sourcebot which repos to index and from where |
| 24 | +- [Language Models](/docs/configuration/language-model-providers) (`models`): Defines a set of language model providers for use with [Ask Sourcebot](/docs/features/ask) |
| 25 | +- [Settings](#settings) (`settings`): Additional settings to tweak your Sourcebot deployment |
| 26 | +- [Search Contexts](/docs/features/search/search-contexts) (`contexts`): Groupings of repos that you can search against |
| 27 | + |
| 28 | +# Config File Syncing |
| 29 | + |
| 30 | +Sourcebot syncs the config file on startup, and automatically whenever a change is detected. |
| 31 | + |
| 32 | +# Settings |
| 33 | + |
| 34 | +The following are settings that can be provided in your config file to modify Sourcebot's behavior |
| 35 | + |
| 36 | +| Setting | Type | Default | Minimum | Description / Notes | |
| 37 | +|-------------------------------------------|---------|------------|---------|----------------------------------------------------------------------------------------| |
| 38 | +| `maxFileSize` | number | 2 MB | 1 | Maximum size (bytes) of a file to index. Files exceeding this are skipped. | |
| 39 | +| `maxTrigramCount` | number | 20 000 | 1 | Maximum trigrams per document. Larger files are skipped. | |
| 40 | +| `reindexIntervalMs` | number | 1 hour | 1 | Interval at which all repositories are re‑indexed. | |
| 41 | +| `resyncConnectionIntervalMs` | number | 24 hours | 1 | Interval for checking connections that need re‑syncing. | |
| 42 | +| `resyncConnectionPollingIntervalMs` | number | 1 second | 1 | DB polling rate for connections that need re‑syncing. | |
| 43 | +| `reindexRepoPollingIntervalMs` | number | 1 second | 1 | DB polling rate for repos that should be re‑indexed. | |
| 44 | +| `maxConnectionSyncJobConcurrency` | number | 8 | 1 | Concurrent connection‑sync jobs. | |
| 45 | +| `maxRepoIndexingJobConcurrency` | number | 8 | 1 | Concurrent repo‑indexing jobs. | |
| 46 | +| `maxRepoGarbageCollectionJobConcurrency` | number | 8 | 1 | Concurrent repo‑garbage‑collection jobs. | |
| 47 | +| `repoGarbageCollectionGracePeriodMs` | number | 10 seconds | 1 | Grace period to avoid deleting shards while loading. | |
| 48 | +| `repoIndexTimeoutMs` | number | 2 hours | 1 | Timeout for a single repo‑indexing run. | |
| 49 | +| `enablePublicAccess` **(deprecated)** | boolean | false | — | Use the `FORCE_ENABLE_ANONYMOUS_ACCESS` environment variable instead. | |
0 commit comments