make embed.FS injectable

This commit is contained in:
ajatprabha
2021-09-18 17:56:00 +05:30
committed by Ken Hibino
parent 0c7eb94fb9
commit 3ec75cad17
22 changed files with 41 additions and 327 deletions

View File

@@ -6,15 +6,13 @@ import (
"io/fs"
"net/http"
"path/filepath"
"github.com/ajatprabha/asynqmon/internal"
)
func NewStaticContentHandler() http.Handler {
func NewStaticContentHandler(contents embed.FS, staticDirPath, indexFileName string) http.Handler {
return &staticContentHandler{
contents: internal.StaticContents,
staticDirPath: "assets",
indexFileName: "index.html",
contents: contents,
staticDirPath: staticDirPath,
indexFileName: indexFileName,
}
}