- update branding colors and Sourcegraph logo images - add global assets folder to Storybook commands |
||
|---|---|---|
| .. | ||
| bookmarklet | ||
| dev | ||
| src | ||
| .eslintignore | ||
| .eslintrc.js | ||
| .stylelintrc.json | ||
| babel.config.js | ||
| gulpfile.js | ||
| jest.config.js | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| webpack.config.js | ||
Web Application
Local development
Use sg CLI tool to configure and start local development server. For more information checkout sg README.
Configuration
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.
Development server
sg run web-standalone
For enterprise version:
sg run enterprise-web-standalone
Production server
sg run web-standalone-prod
For enterprise version:
sg run enterprise-web-standalone-prod
Web app should be available at http://${SOURCEGRAPH_HTTPS_DOMAIN}:${SOURCEGRAPH_HTTPS_PORT}.
Build artifacts will be served from <rootRepoPath>/ui/assets.
API proxy
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.