Use sg CLI tool to configure and start local development server. For more information checkout sg README.
Environment variables important for the web server:
WEBPACK_SERVE_INDEXshould be set totrueto enableHTMLWebpackPlugin.SOURCEGRAPH_API_URLis used as a proxied API url. By default it points to the https://k8s.sgdev.org.
It's possible to overwrite these variables by creating sg.config.overwrite.yaml in the root folder and adjusting the env section of the relevant command.
sg run web-standaloneFor enterprise version:
sg run enterprise-web-standalonesg run web-standalone-prodFor enterprise version:
sg run enterprise-web-standalone-prodWeb app should be available at http://${SOURCEGRAPH_HTTPS_DOMAIN}:${SOURCEGRAPH_HTTPS_PORT}.
Build artifacts will be served from <rootRepoPath>/ui/assets.
In both environments, server proxies API requests to SOURCEGRAPH_API_URL provided as the .env variable.
To avoid the CSRF token is invalid error CSRF token is retrieved from the SOURCEGRAPH_API_URL before the server starts.
Then this value is used for every subsequent request to the API.