Site configuration defines how various Sourcegraph features behave. See the full reference below for a comprehensive list of site configuration options.
Site admins can view and edit site configuration on a Sourcegraph instance:
- Go to User menu > Site admin.
- Open the Configuration page. (The URL is
https://sourcegraph.example.com/site-admin/configuration
.)
All site configuration options and their default values are shown below.
The following site configuration options require the server to be restarted for the changes to take effect:
auth.accessTokens
auth.sessionExpiry
git.cloneURLToRepositoryName
searchScopes
extensions
disablePublicRepoRedirects
If you are having trouble accessing the web UI, you can make edits to your site configuration by editing a file in the Docker container using the following commands:
For Sourcegraph v3.12.1+ use:
docker exec -it $CONTAINER sh -c 'apk add --no-cache nano && nano ~/site-config.json'
Or if you prefer using a Vim editor:
docker exec -it $CONTAINER sh -c 'vi ~/site-config.json'
Note: Not running Sourcegraph v3.12.1+? Use the following:
docker exec -it $CONTAINER sh -c 'apk add --no-cache nano && nano /site-config.json'
Or if you prefer using a Vim editor:
docker exec -it $CONTAINER sh -c 'vi /site-config.json'
kubectl exec -it $FRONTEND_POD -- sh -c 'apk add --no-cache nano && nano ~/site-config.json'
Or if you prefer using a Vim editor:
kubectl exec -it $FRONTEND_POD -- sh -c 'vi ~/site-config.json'
Note: Not running Sourcegraph v3.12.1+? Use the following:
kubectl exec -it $FRONTEND_POD -- sh -c 'apk add --no-cache nano && nano /site-config.json'
Or if you prefer using a Vim editor:
kubectl exec -it $FRONTEND_POD -- sh -c 'vi /site-config.json'
Then simply save your changes (type ctrl+x and y to exit nano
and save your changes). Your changes will be applied immediately in the same was as if you had made them through the web UI.
You can check the container logs to see if you have made any typos or mistakes in editing the configuration file. If you are still encountering problems, you can save the default site configuration that comes with Sourcegraph (below) or contact [email protected] with any questions you have.
{
// The externally accessible URL for Sourcegraph (i.e., what you type into your browser)
// This is required to be configured for Sourcegraph to work correctly.
// "externalURL": "https://sourcegraph.example.com",
// The authentication provider to use for identifying and signing in users.
// Only one entry is supported.
//
// The builtin auth provider with signup disallowed (shown below) means that
// after the initial site admin signs in, all other users must be invited.
//
// Other providers are documented at https://docs.sourcegraph.com/admin/auth.
"auth.providers": [
{
"type": "builtin",
"allowSignup": false
}
],
"search.index.enabled": true
}