github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/clients/pkg/promtail/server/ui/ui.go (about) 1 //go:build dev 2 // +build dev 3 4 package ui 5 6 import ( 7 "net/http" 8 "os" 9 "strings" 10 11 "github.com/shurcooL/httpfs/filter" 12 "github.com/shurcooL/httpfs/union" 13 ) 14 15 var static http.FileSystem = filter.Keep( 16 http.Dir("./static"), 17 func(path string, fi os.FileInfo) bool { 18 return fi.IsDir() || 19 (!strings.HasSuffix(path, "map.js") && 20 !strings.HasSuffix(path, "/bootstrap.js") && 21 !strings.HasSuffix(path, "/bootstrap-theme.css") && 22 !strings.HasSuffix(path, "/bootstrap.css")) 23 }, 24 ) 25 26 var templates http.FileSystem = filter.Keep( 27 http.Dir("./templates"), 28 func(path string, fi os.FileInfo) bool { 29 return fi.IsDir() || strings.HasSuffix(path, ".html") 30 }, 31 ) 32 33 // Assets contains the project's assets loaded from local file system when build with `-tags dev` 34 var Assets http.FileSystem = union.New(map[string]http.FileSystem{ 35 "/templates": templates, 36 "/static": static, 37 })