You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
continuous-integration/woodpecker the build was successful
Details
Reviewed-on: #7 Co-authored-by: jolheiser <john.olheiser@gmail.com> Co-committed-by: jolheiser <john.olheiser@gmail.com> |
1 year ago | |
---|---|---|
_test | 2 years ago | |
.gitignore | 2 years ago | |
.woodpecker.yml | 1 year ago | |
LICENSE | 2 years ago | |
README.md | 2 years ago | |
go.mod | 2 years ago | |
overlay.go | 1 year ago | |
overlay_test.go | 2 years ago |
README.md
Overlay
Overlay File System
Overlay is an easy way to implement a file system in such a way that production assets can be overridden by assets on disk.
Usage
package main
import (
"embed"
"go.jolheiser.com/overlay"
)
//go:embed assets
var assets embed.FS
func main() {
ofs, err := overlay.New("/var/lib/myapp/custom", assets)
if err != nil {
panic(err)
}
...
}
If /var/lib/myapp/custom
has an assets
sub-directory, this implementation works.
However, if /var/lib/myapp/custom
matches the assets
directory layout,
you can use WithSub
like so...
package main
import (
"embed"
"go.jolheiser.com/overlay"
)
//go:embed assets
var assets embed.FS
func main() {
ofs, err := overlay.New("/var/lib/myapp/custom", assets, overlay.WithSub("assets"))
if err != nil {
panic(err)
}
...
}