Overlay file system
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jolheiser eefdce7b03 Add cache purge (#7) 2 weeks ago
_test Initial Commit 8 months ago
.gitignore Initial Commit 8 months ago
.woodpecker.yml Move to woodpecker (#6) 2 weeks ago
LICENSE Initial Commit 8 months ago
README.md Replace build badge with docs badge (#3) 6 months ago
go.mod Rebrand overlay 8 months ago
overlay.go Add cache purge (#7) 2 weeks ago
overlay_test.go Add ReadFile, interface guard, and drone CI (#2) 6 months ago

README.md

Overlay

Go Reference

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)
    }
    ...
}

License

MIT