feat: limit file operations using os.Root
1 file changed, 20 insertions(+), 1 deletion(-)
changed files
M frontend/dev.go → frontend/dev.go
@@ -3,7 +3,26 @@ package frontend import ( + "io/fs" "os" + "path/filepath" + + "alin.ovh/searchix/internal/file" ) -var Files = os.DirFS("frontend/") +var Files fs.FS + +func init() { + wd, err := os.Getwd() + if err != nil { + panic(err) + } + + //nolint:forbidigo // own source code + root, err := file.OpenRoot(filepath.Join(wd, "frontend")) + if err != nil { + panic(err) + } + + Files = root.FS() +}