mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
Merge pull request #49 from prymitive/static-src
feat(sentry): bundle raw UI source files for sentry
This commit is contained in:
2
Makefile
2
Makefile
@@ -51,7 +51,7 @@ endif
|
||||
touch $@
|
||||
|
||||
bindata_assetfs.go: .build/deps-build-go.ok .build/artifacts-bindata_assetfs.$(GO_BINDATA_MODE) .build/vendor.ok .build/artifacts-ui.ok
|
||||
go-bindata-assetfs -o bindata_assetfs.go -nometadata ui/build/...
|
||||
go-bindata-assetfs -o bindata_assetfs.go -nometadata ui/build/... ui/src/...
|
||||
|
||||
$(NAME): .build/deps-build-go.ok .build/vendor.ok bindata_assetfs.go $(SOURCES)
|
||||
go build -ldflags "-X main.version=$(VERSION)"
|
||||
|
||||
12
main.go
12
main.go
@@ -39,8 +39,8 @@ var (
|
||||
// rather than do all the filtering every time
|
||||
apiCache *cache.Cache
|
||||
|
||||
// used by static file view handlers
|
||||
staticFileSystem = newBinaryFileSystem("ui/build")
|
||||
staticBuildFileSystem = newBinaryFileSystem("ui/build")
|
||||
staticSrcFileSystem = newBinaryFileSystem("ui/src")
|
||||
)
|
||||
|
||||
func getViewURL(sub string) string {
|
||||
@@ -55,7 +55,13 @@ func getViewURL(sub string) string {
|
||||
|
||||
func setupRouter(router *gin.Engine) {
|
||||
router.Use(gzip.Gzip(gzip.DefaultCompression))
|
||||
router.Use(static.Serve(getViewURL("/"), staticFileSystem))
|
||||
router.Use(static.Serve(getViewURL("/"), staticBuildFileSystem))
|
||||
// next 2 lines are to allow service raw sources so sentry can fetch source maps
|
||||
router.Use(static.Serve(getViewURL("/static/js/"), staticSrcFileSystem))
|
||||
// FIXME
|
||||
// compressed sources are under /static/js/main.js and reference ../static/js/main.js
|
||||
// so we end up with /static/static/js
|
||||
router.Use(static.Serve(getViewURL("/static/static/js/"), staticSrcFileSystem))
|
||||
router.Use(cors.New(cors.Config{
|
||||
AllowAllOrigins: true,
|
||||
AllowCredentials: true,
|
||||
|
||||
Reference in New Issue
Block a user