schnutibox/assets/web/assets.go
Marvin Steadfast 8e9b7d5e3e
All checks were successful
continuous-integration/drone/push Build is passing
adds swagger ui
2021-05-14 09:48:45 +02:00

35 lines
544 B
Go

//nolint:gochecknoglobals,golint,stylecheck
package web
import (
"embed"
"io/fs"
"net/http"
"github.com/rs/zerolog/log"
)
//go:embed files
var files embed.FS
var Files = sub(files, "files")
//go:embed templates
var Templates embed.FS
//go:embed swagger-ui
var swaggerUI embed.FS
var SwaggerUI = sub(swaggerUI, "swagger-ui")
func sub(f embed.FS, dir string) http.FileSystem {
fsys, err := fs.Sub(f, dir)
if err != nil {
log.Error().Err(err).Str("dir", dir).Msg("could not sub into dir")
return nil
}
return http.FS(fsys)
}